-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #501 from dzikowski/upgrade_to_version3
Add support for BFT and improve Fabric v3 support
- Loading branch information
Showing
37 changed files
with
10,294 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ fablo-target | |
generators | ||
node_modules | ||
.idea | ||
samples/invalid-fablo-config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
# Test cases | ||
|
||
| Test case | 01-simple | 02-raft | 03-private | 04-snapshot | | ||
| ------------------------- |:---------------:|:-----------:|:----------:|:------------------------:| | ||
| Fabric versions | 2.4.7 | 2.3.2 | 2.4.7 | 2.3.3/2.4.2 | | ||
| TLS | no | yes | no | yes | | ||
| Channel capabilities | v2 | v2 | v2_5 | v2 | | ||
| Consensus | solo | RAFT | solo | RAFT | | ||
| Orderer nodes | 1 | 3 | 1 | 1 | | ||
| Organizations | 1 | 2 | 2 | 1 | | ||
| CA database | SQLite | SQLite | SQLite | Postgres | | ||
| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | | ||
| Peer count | 2 | 2, 2 | 2, 1 | 2 | | ||
| Channels | 1 | 2 | 1 | 1 | | ||
| Node chaincode | yes | yes | yes | yes | | ||
| Node chaincode upgrade | no | yes | no | no | | ||
| Node chaincode endorsement| OR | OR | OR, AND | default | | ||
| Private data | no | no | yes | yes | | ||
| Java chaincode | no | yes | no | no | | ||
| Go chaincode | no | no | no | no | | ||
| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | | ||
| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | | ||
| Test case | 01-simple | 02-raft | 03-private | 04-snapshot | test-05-version3 | test-05-version3-BFT | | ||
| ------------------------- |:---------------:|:-----------:|:----------:|:------------------------:|:------------------:|:---------------------:| | ||
| Fabric versions | 2.4.7 | 2.3.2 | 2.4.7 | 2.3.3/2.4.2 | 3.0.0-beta | 3.0.0-beta | | ||
| TLS | no | yes | no | yes | yes | yes | | ||
| Channel capabilities | v2 | v2 | v2_5 | v2 | v3_0 | v3_0 | | ||
| Consensus | solo | RAFT | solo | RAFT | RAFT | BFT | | ||
| Orderer nodes | 1 | 3 | 1 | 1 | 3 | 4 | | ||
| Organizations | 1 | 2 | 2 | 1 | 1 | 1 | | ||
| CA database | SQLite | SQLite | SQLite | Postgres | SQLite | SQLite | | ||
| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | LevelDB | LevelDB | | ||
| Peer count | 2 | 2, 2 | 2, 1 | 2 | 2 | 2 | | ||
| Channels | 1 | 2 | 1 | 1 | 1 | 1 | | ||
| Node chaincode | yes | yes | yes | yes | yes | yes | | ||
| Node chaincode upgrade | no | yes | no | no | no | no | | ||
| Node chaincode endorsement| OR | OR | OR, AND | default | OR | OR | | ||
| Private data | no | no | yes | yes | no | no | | ||
| Java chaincode | no | yes | no | no | no | no | | ||
| Go chaincode | no | no | no | no | no | no | | ||
| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | - | - | | ||
| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | - | - | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" | ||
TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" | ||
FABLO_HOME="$TEST_TMP/../../.." | ||
|
||
export FABLO_HOME | ||
|
||
CONFIG="$FABLO_HOME/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json" | ||
|
||
networkUp() { | ||
"$FABLO_HOME/fablo-build.sh" | ||
(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" generate "$CONFIG") | ||
(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" up) | ||
} | ||
|
||
dumpLogs() { | ||
echo "Saving logs of $1 to $TEST_LOGS/$1.log" | ||
mkdir -p "$TEST_LOGS" | ||
docker logs "$1" >"$TEST_LOGS/$1.log" 2>&1 | ||
} | ||
|
||
networkDown() { | ||
rm -rf "$TEST_LOGS" | ||
(for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) | ||
dumpLogs orderer0.group1.orderer.example.com | ||
(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) | ||
} | ||
|
||
waitForContainer() { | ||
sh "$TEST_TMP/../wait-for-container.sh" "$1" "$2" | ||
} | ||
|
||
waitForChaincode() { | ||
(cd "$TEST_TMP" && sh ../wait-for-chaincode.sh "$1" "$2" "$3" "$4") | ||
} | ||
|
||
expectInvoke() { | ||
(cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "") | ||
} | ||
|
||
expectCommand() { | ||
sh "$TEST_TMP/../expect-command.sh" "$1" "$2" | ||
} | ||
|
||
trap networkDown EXIT | ||
trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT | ||
|
||
# start the network | ||
networkUp | ||
|
||
waitForContainer "orderer0.group1.orderer.example.com" "Channel created" | ||
waitForContainer "orderer1.group1.orderer.example.com" "Channel created" | ||
waitForContainer "orderer2.group1.orderer.example.com" "Channel created" | ||
waitForContainer "orderer3.group1.orderer.example.com" "Channel created" | ||
waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" | ||
waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" | ||
waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" | ||
waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" | ||
waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" | ||
waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" | ||
waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" | ||
waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" | ||
|
||
# Test simple chaincode | ||
expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ | ||
'{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ | ||
'{\"success\":\"OK\"}' | ||
expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ | ||
'{"Args":["KVContract:get", "name"]}' \ | ||
'{\"success\":\"Willy Wonka\"}' | ||
|
||
# Verify channel query scripts | ||
(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) | ||
expectCommand "cat \"$TEST_TMP/newest.block\"" "KVContract:get" | ||
|
||
(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 3 my-channel1 org1 peer1 "another.block") | ||
expectCommand "cat \"$TEST_TMP/another.block\"" "KVContract:put" | ||
|
||
(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch config my-channel1 org1 peer1 "channel-config.json") | ||
expectCommand "cat \"$TEST_TMP/channel-config.json\"" "\"mod_policy\": \"Admins\"," | ||
|
||
expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":5" | ||
|
||
echo "🎉 Test passed! 🎉" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" | ||
TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" | ||
FABLO_HOME="$TEST_TMP/../../.." | ||
|
||
export FABLO_HOME | ||
|
||
CONFIG="$FABLO_HOME/samples/fablo-config-hlf3-1orgs-1chaincode.json" | ||
|
||
networkUp() { | ||
"$FABLO_HOME/fablo-build.sh" | ||
(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" generate "$CONFIG") | ||
(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" up) | ||
} | ||
|
||
dumpLogs() { | ||
echo "Saving logs of $1 to $TEST_LOGS/$1.log" | ||
mkdir -p "$TEST_LOGS" | ||
docker logs "$1" >"$TEST_LOGS/$1.log" 2>&1 | ||
} | ||
|
||
networkDown() { | ||
rm -rf "$TEST_LOGS" | ||
(for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) | ||
dumpLogs orderer0.group1.orderer.example.com | ||
(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) | ||
} | ||
|
||
waitForContainer() { | ||
sh "$TEST_TMP/../wait-for-container.sh" "$1" "$2" | ||
} | ||
|
||
waitForChaincode() { | ||
(cd "$TEST_TMP" && sh ../wait-for-chaincode.sh "$1" "$2" "$3" "$4") | ||
} | ||
|
||
expectInvoke() { | ||
(cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "") | ||
} | ||
|
||
expectCommand() { | ||
sh "$TEST_TMP/../expect-command.sh" "$1" "$2" | ||
} | ||
|
||
trap networkDown EXIT | ||
trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT | ||
|
||
# start the network | ||
networkUp | ||
|
||
waitForContainer "orderer0.group1.orderer.example.com" "Starting raft node as part of a new channel channel=my-channel1" | ||
waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" | ||
waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" | ||
waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" | ||
waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" | ||
waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" | ||
waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" | ||
waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" | ||
waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" | ||
|
||
# Test simple chaincode | ||
expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ | ||
'{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ | ||
'{\"success\":\"OK\"}' | ||
expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ | ||
'{"Args":["KVContract:get", "name"]}' \ | ||
'{\"success\":\"Willy Wonka\"}' | ||
|
||
# Verify channel query scripts | ||
(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) | ||
expectCommand "cat \"$TEST_TMP/newest.block\"" "KVContract:get" | ||
|
||
(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 3 my-channel1 org1 peer1 "another.block") | ||
expectCommand "cat \"$TEST_TMP/another.block\"" "KVContract:put" | ||
|
||
(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch config my-channel1 org1 peer1 "channel-config.json") | ||
expectCommand "cat \"$TEST_TMP/channel-config.json\"" "\"mod_policy\": \"Admins\"," | ||
|
||
expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":5" | ||
|
||
echo "🎉 Test passed! 🎉" |
Oops, something went wrong.