Skip to content

Commit 18ac27a

Browse files
authored
Merge pull request #513 from umegbewe/feat/support-fabric-v3-completion
feat: fabric v3 support completion
1 parent befa999 commit 18ac27a

11 files changed

+86
-62
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 2.2.0
2+
3+
### Features
4+
* Full support for Fabric 3.0.0 and drop solo consensus
5+
[#513](https://github.com/hyperledger-labs/fablo/pull/513)
6+
17
## 2.1.0
28

39
### Features

e2e/__snapshots__/extendConfig.test.ts.snap

+5-5
Original file line numberDiff line numberDiff line change
@@ -9806,14 +9806,14 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = `
98069806
"orderer": "V2_0",
98079807
},
98089808
"engine": "docker",
9809-
"fabricBaseosVersion": "3.0.0-beta",
9809+
"fabricBaseosVersion": "3.0.0",
98109810
"fabricCaVersion": "1.5.5",
9811-
"fabricCcenvVersion": "3.0.0-beta",
9811+
"fabricCcenvVersion": "3.0.0",
98129812
"fabricJavaenvVersion": "2.5",
98139813
"fabricNodeenvVersion": "2.5",
98149814
"fabricRecommendedNodeVersion": "16",
9815-
"fabricToolsVersion": "3.0.0-beta",
9816-
"fabricVersion": "3.0.0-beta",
9815+
"fabricToolsVersion": "3.0.0",
9816+
"fabricVersion": "3.0.0",
98179817
"monitoring": {
98189818
"loglevel": "debug",
98199819
},
@@ -10770,7 +10770,7 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] =
1077010770
"fabricJavaenvVersion": "2.5",
1077110771
"fabricNodeenvVersion": "2.5",
1077210772
"fabricRecommendedNodeVersion": "16",
10773-
"fabricToolsVersion": "3.0.0-beta",
10773+
"fabricToolsVersion": "3.0.0",
1077410774
"fabricVersion": "3.0.0-beta",
1077510775
"monitoring": {
1077610776
"loglevel": "debug",

e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap

+21-17
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ Organizations:
4343
Name: OrdererMSP
4444
ID: OrdererMSP
4545
MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp
46-
46+
OrdererEndpoints:
47+
- orderer0.group1.orderer.example.com:7030
48+
- orderer1.group1.orderer.example.com:7031
49+
- orderer2.group1.orderer.example.com:7032
50+
- orderer3.group1.orderer.example.com:7033
4751
Policies:
4852
Readers:
4953
Type: Signature
@@ -64,7 +68,11 @@ Organizations:
6468
Name: Org1MSP
6569
ID: Org1MSP
6670
MSPDir: crypto-config/peerOrganizations/org1.example.com/msp
67-
71+
OrdererEndpoints:
72+
- orderer0.group1.orderer.example.com:7030
73+
- orderer1.group1.orderer.example.com:7031
74+
- orderer2.group1.orderer.example.com:7032
75+
- orderer3.group1.orderer.example.com:7033
6876
Policies:
6977
Readers:
7078
Type: Signature
@@ -115,11 +123,7 @@ Application: &ApplicationDefaults
115123
################################################################################
116124
Orderer: &Group1Defaults
117125
OrdererType: etcdraft
118-
Addresses:
119-
- orderer0.group1.orderer.example.com:7030
120-
- orderer1.group1.orderer.example.com:7031
121-
- orderer2.group1.orderer.example.com:7032
122-
- orderer3.group1.orderer.example.com:7033
126+
123127
EtcdRaft:
124128
Consenters:
125129
- Host: orderer0.group1.orderer.example.com
@@ -1521,12 +1525,12 @@ CHAINCODES_BASE_DIR=<absolute path>
15211525
COMPOSE_PROJECT_NAME=<name with timestamp>
15221526
LOGGING_LEVEL=debug
15231527
1524-
FABRIC_VERSION=3.0.0-beta
1525-
FABRIC_TOOLS_VERSION=3.0.0-beta
1528+
FABRIC_VERSION=3.0.0
1529+
FABRIC_TOOLS_VERSION=3.0.0
15261530
FABRIC_CA_VERSION=1.5.5
15271531
FABRIC_CA_POSTGRES_VERSION=14
1528-
FABRIC_CCENV_VERSION=3.0.0-beta
1529-
FABRIC_BASEOS_VERSION=3.0.0-beta
1532+
FABRIC_CCENV_VERSION=3.0.0
1533+
FABRIC_BASEOS_VERSION=3.0.0
15301534
FABRIC_JAVAENV_VERSION=2.5
15311535
FABRIC_NODEENV_VERSION=2.5
15321536
RECOMMENDED_NODE_VERSION=16
@@ -1920,7 +1924,7 @@ services:
19201924
19211925
cli.orderer.example.com:
19221926
container_name: cli.orderer.example.com
1923-
image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION}
1927+
image: ghcr.io/fablo-io/fabric-tools:\${FABRIC_TOOLS_VERSION}
19241928
tty: true
19251929
environment:
19261930
- GOPATH=/opt/gopath
@@ -2146,7 +2150,7 @@ services:
21462150
21472151
cli.org1.example.com:
21482152
container_name: cli.org1.example.com
2149-
image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION}
2153+
image: ghcr.io/fablo-io/fabric-tools:\${FABRIC_TOOLS_VERSION}
21502154
tty: true
21512155
environment:
21522156
- GOPATH=/opt/gopath
@@ -2305,7 +2309,7 @@ certsGenerate() {
23052309
exit 1
23062310
fi
23072311
2308-
docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
2312+
docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
23092313
docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME
23102314
23112315
docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME
@@ -2341,7 +2345,7 @@ genesisBlockCreate() {
23412345
exit 1
23422346
fi
23432347
2344-
docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
2348+
docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
23452349
docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME
23462350
23472351
docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME
@@ -2378,7 +2382,7 @@ createChannelTx() {
23782382
--name $CONTAINER_NAME \\
23792383
-v "$CONFIG_PATH":/fabric-config \\
23802384
-v "$OUTPUT_PATH":/output \\
2381-
hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\
2385+
ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\
23822386
bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile \${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID \${CHANNEL_NAME}"
23832387
23842388
# shellcheck disable=SC2181
@@ -2417,7 +2421,7 @@ createNewChannelUpdateTx() {
24172421
exit 1
24182422
fi
24192423
2420-
docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
2424+
docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
24212425
docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME
24222426
24232427
docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME

e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap

+17-14
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ Organizations:
4343
Name: OrdererMSP
4444
ID: OrdererMSP
4545
MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp
46-
46+
OrdererEndpoints:
47+
- orderer0.group1.orderer.example.com:7030
48+
- orderer1.group1.orderer.example.com:7031
49+
- orderer2.group1.orderer.example.com:7032
50+
- orderer3.group1.orderer.example.com:7033
4751
Policies:
4852
Readers:
4953
Type: Signature
@@ -64,7 +68,11 @@ Organizations:
6468
Name: Org1MSP
6569
ID: Org1MSP
6670
MSPDir: crypto-config/peerOrganizations/org1.example.com/msp
67-
71+
OrdererEndpoints:
72+
- orderer0.group1.orderer.example.com:7030
73+
- orderer1.group1.orderer.example.com:7031
74+
- orderer2.group1.orderer.example.com:7032
75+
- orderer3.group1.orderer.example.com:7033
6876
Policies:
6977
Readers:
7078
Type: Signature
@@ -115,11 +123,6 @@ Application: &ApplicationDefaults
115123
################################################################################
116124
Orderer: &Group1Defaults
117125
OrdererType: BFT
118-
Addresses:
119-
- orderer0.group1.orderer.example.com:7030
120-
- orderer1.group1.orderer.example.com:7031
121-
- orderer2.group1.orderer.example.com:7032
122-
- orderer3.group1.orderer.example.com:7033
123126
124127
SmartBFT:
125128
RequestBatchMaxCount: 100
@@ -1548,7 +1551,7 @@ COMPOSE_PROJECT_NAME=<name with timestamp>
15481551
LOGGING_LEVEL=debug
15491552
15501553
FABRIC_VERSION=3.0.0-beta
1551-
FABRIC_TOOLS_VERSION=3.0.0-beta
1554+
FABRIC_TOOLS_VERSION=3.0.0
15521555
FABRIC_CA_VERSION=1.5.5
15531556
FABRIC_CA_POSTGRES_VERSION=14
15541557
FABRIC_CCENV_VERSION=3.0.0-beta
@@ -1945,7 +1948,7 @@ services:
19451948
19461949
cli.orderer.example.com:
19471950
container_name: cli.orderer.example.com
1948-
image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION}
1951+
image: ghcr.io/fablo-io/fabric-tools:\${FABRIC_TOOLS_VERSION}
19491952
tty: true
19501953
environment:
19511954
- GOPATH=/opt/gopath
@@ -2171,7 +2174,7 @@ services:
21712174
21722175
cli.org1.example.com:
21732176
container_name: cli.org1.example.com
2174-
image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION}
2177+
image: ghcr.io/fablo-io/fabric-tools:\${FABRIC_TOOLS_VERSION}
21752178
tty: true
21762179
environment:
21772180
- GOPATH=/opt/gopath
@@ -2330,7 +2333,7 @@ certsGenerate() {
23302333
exit 1
23312334
fi
23322335
2333-
docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
2336+
docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
23342337
docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME
23352338
23362339
docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME
@@ -2366,7 +2369,7 @@ genesisBlockCreate() {
23662369
exit 1
23672370
fi
23682371
2369-
docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
2372+
docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
23702373
docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME
23712374
23722375
docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME
@@ -2403,7 +2406,7 @@ createChannelTx() {
24032406
--name $CONTAINER_NAME \\
24042407
-v "$CONFIG_PATH":/fabric-config \\
24052408
-v "$OUTPUT_PATH":/output \\
2406-
hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\
2409+
ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\
24072410
bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile \${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID \${CHANNEL_NAME}"
24082411
24092412
# shellcheck disable=SC2181
@@ -2442,7 +2445,7 @@ createNewChannelUpdateTx() {
24422445
exit 1
24432446
fi
24442447
2445-
docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
2448+
docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
24462449
docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME
24472450
24482451
docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME

fablo-build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ else
4646
--tag "$IMAGE_BASE_NAME" "$FABLO_HOME"
4747

4848
docker tag "$IMAGE_BASE_NAME" "ghcr.io/fablo-io/fablo:$FABLO_VERSION"
49-
fi
49+
fi

samples/fablo-config-hlf3-1orgs-1chaincode.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json",
33
"global": {
4-
"fabricVersion": "3.0.0-beta",
4+
"fabricVersion": "3.0.0",
55
"tls": true,
66
"monitoring": {
77
"loglevel": "debug"

src/extend-config/extendGlobal.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ const getVersions = (fabricVersion: string): FabricVersions => {
2424

2525
const below3_0_0 = (v: string) => (v.startsWith("3.") ? "2.5" : v);
2626

27-
const beta3_0_0 = (v: string) => (v.startsWith("3.0.") ? "3.0.0-beta" : v);
27+
const is_or_above3_0_0 = (v: string) => (v.startsWith("3.") ? "3.0.0" : v);
2828

2929
return {
3030
fabricVersion,
31-
fabricToolsVersion: beta3_0_0(fabricVersion),
31+
fabricToolsVersion: is_or_above3_0_0(fabricVersion),
3232
fabricCaVersion: version(fabricVersion).isGreaterOrEqual("1.4.10") ? "1.5.5" : fabricVersion,
3333
fabricCcenvVersion: fabricVersion,
3434
fabricBaseosVersion: version(fabricVersion).isGreaterOrEqual("2.0") ? fabricVersion : "0.4.9",

src/setup-docker/templates/fabric-config/configtx.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Organizations:
3535
Name: <%= org.mspName %>
3636
ID: <%= org.mspName %>
3737
MSPDir: crypto-config/peerOrganizations/<%= org.domain %>/msp
38+
<%_ if (global.capabilities.isV3) { _%>
39+
OrdererEndpoints:<% ordererGroups[0].orderers.forEach(function(orderer) { %>
40+
- <%= orderer.fullAddress %><% }) -%>
41+
<%_ } _%>
3842

3943
Policies:
4044
Readers:
@@ -89,8 +93,10 @@ Application: &ApplicationDefaults
8993
<%_ ordererGroups.forEach(function(ordererGroup) { _%>
9094
Orderer: &<%= ordererGroup.configtxOrdererDefaults %>
9195
OrdererType: <%= ordererGroup.consensus %>
96+
<%_ if (!global.capabilities.isV3) { _%>
9297
Addresses:<% ordererGroup.orderers.forEach(function(orderer) { %>
9398
- <%= orderer.fullAddress %><% })-%>
99+
<%_ } _%>
94100
<%- include('configtx-raft-template.yaml.ejs', {ordererGroup: ordererGroup}); %>
95101
BatchTimeout: 2s
96102
BatchSize:

src/setup-docker/templates/fabric-docker/docker-compose.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ services:
5656

5757
<%= org.cli.address %>:
5858
container_name: <%= org.cli.address %>
59+
<%_ if(global.capabilities.isV3) { _%>
60+
image: ghcr.io/fablo-io/fabric-tools:${FABRIC_TOOLS_VERSION}
61+
<%_ } else { _%>
5962
image: hyperledger/fabric-tools:${FABRIC_TOOLS_VERSION}
63+
<%_ } _%>
6064
tty: true
6165
environment:
6266
- GOPATH=/opt/gopath

src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ certsGenerate() {
2222
exit 1
2323
fi
2424

25-
docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
25+
docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
2626
docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME
2727

2828
docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME
@@ -58,7 +58,7 @@ genesisBlockCreate() {
5858
exit 1
5959
fi
6060

61-
docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
61+
docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
6262
docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME
6363

6464
docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME
@@ -95,7 +95,7 @@ createChannelTx() {
9595
--name $CONTAINER_NAME \
9696
-v "$CONFIG_PATH":/fabric-config \
9797
-v "$OUTPUT_PATH":/output \
98-
hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" \
98+
ghcr.io/fablo-io/fabric-tools:"${FABRIC_TOOLS_VERSION}" \
9999
bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile ${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID ${CHANNEL_NAME}"
100100

101101
# shellcheck disable=SC2181
@@ -136,7 +136,7 @@ createNewChannelUpdateTx() {
136136
exit 1
137137
fi
138138

139-
docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
139+
docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME
140140
docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME
141141

142142
docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME

0 commit comments

Comments
 (0)