From aa33bd6f250dda3de8d0ac02a820c4b501b5c6e0 Mon Sep 17 00:00:00 2001 From: Parameswaran Selvam Date: Thu, 23 Feb 2023 03:44:23 -0800 Subject: [PATCH] Update to use channel participation api Signed-off-by: Parameswaran Selvam --- test-network-nano-bash/configtx.yaml | 31 +------------ test-network-nano-bash/generate_artifacts.sh | 21 ++++----- test-network-nano-bash/network.sh | 48 ++++++++++---------- test-network-nano-bash/orderer1.sh | 23 ++++++---- test-network-nano-bash/orderer2.sh | 23 ++++++---- test-network-nano-bash/orderer3.sh | 23 ++++++---- test-network-nano-bash/orderer4.sh | 23 ++++++---- 7 files changed, 88 insertions(+), 104 deletions(-) diff --git a/test-network-nano-bash/configtx.yaml b/test-network-nano-bash/configtx.yaml index 98d9e8c7..74fe9a76 100644 --- a/test-network-nano-bash/configtx.yaml +++ b/test-network-nano-bash/configtx.yaml @@ -297,8 +297,7 @@ Channel: &ChannelDefaults # ################################################################################ Profiles: - - TwoOrgsOrdererGenesis: + TwoOrgsChannel: <<: *ChannelDefaults Orderer: <<: *OrdererDefaults @@ -327,14 +326,6 @@ Profiles: HeartbeatTick: 1 MaxInflightBlocks: 5 SnapshotIntervalSize: 16 MB - Consortiums: - SampleConsortium: - Organizations: - - *Org1 - - *Org2 - TwoOrgsChannel: - Consortium: SampleConsortium - <<: *ChannelDefaults Application: <<: *ApplicationDefaults Organizations: @@ -342,24 +333,6 @@ Profiles: - *Org2 Capabilities: <<: *ApplicationCapabilities - Org1Channel: - Consortium: SampleConsortium - <<: *ChannelDefaults - Application: - <<: *ApplicationDefaults - Organizations: - - *Org1 - Capabilities: - <<: *ApplicationCapabilities - Org2Channel: - Consortium: SampleConsortium - <<: *ChannelDefaults - Application: - <<: *ApplicationDefaults - Organizations: - - *Org2 - Capabilities: - <<: *ApplicationCapabilities BFTTwoOrgsApplicationGenesis: <<: *ChannelDefaults Orderer: @@ -385,7 +358,7 @@ Profiles: CollectTimeout: 1s RequestBatchMaxBytes: 10485760 IncomingMessageBufferSize: 200 - RequestPoolSize: 400 + RequestPoolSize: 100000 LeaderHeartbeatCount: 10 ConsenterMapping: - ID: 1 diff --git a/test-network-nano-bash/generate_artifacts.sh b/test-network-nano-bash/generate_artifacts.sh index 1c534a57..b8c60852 100755 --- a/test-network-nano-bash/generate_artifacts.sh +++ b/test-network-nano-bash/generate_artifacts.sh @@ -18,17 +18,16 @@ cryptogen generate --config="${PWD}"/crypto-config.yaml # set FABRIC_CFG_PATH to configtx.yaml directory that contains the profiles export FABRIC_CFG_PATH="${PWD}" -echo "Generating orderer genesis block" -configtxgen -profile TwoOrgsOrdererGenesis -channelID test-system-channel-name -outputBlock channel-artifacts/genesis.block +ordererType="etcdraft" +if [ $# -gt 0 ] && [ "$1" = "BFT" ] +then + profile="BFTTwoOrgsApplicationGenesis" + ordererType="BFT" +else + profile="TwoOrgsChannel" +fi -echo "Generating channel create config transaction" -configtxgen -channelID mychannel -outputCreateChannelTx channel-artifacts/mychannel.tx -profile TwoOrgsChannel +echo "Generating application channel genesis block with ${ordererType} consensus" +configtxgen -profile ${profile} -outputBlock ./channel-artifacts/mychannel.block -channelID mychannel -echo "Generating anchor peer update transaction for Org1" -configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate channel-artifacts/Org1MSPanchors.tx -channelID mychannel -asOrg Org1MSP -echo "Generating anchor peer update transaction for Org2" -configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate channel-artifacts/Org2MSPanchors.tx -channelID mychannel -asOrg Org2MSP - -echo "Generating application channel genesis block with BFT consensus" -configtxgen -profile BFTTwoOrgsApplicationGenesis -outputBlock ./channel-artifacts/mychannel.block -channelID mychannel diff --git a/test-network-nano-bash/network.sh b/test-network-nano-bash/network.sh index ddd93d9c..0ee4f4d2 100755 --- a/test-network-nano-bash/network.sh +++ b/test-network-nano-bash/network.sh @@ -57,7 +57,7 @@ networkStart() { CREATE_CHANNEL=false else echo "Generating artifacts..." - ./generate_artifacts.sh + ./generate_artifacts.sh "${ORDERER_TYPE}" CREATE_CHANNEL=true fi @@ -65,13 +65,13 @@ networkStart() { mkdir -p "${PWD}"/logs echo "Starting orderers..." - ./orderer1.sh ${ORDERER_TYPE} > ./logs/orderer1.log 2>&1 & - ./orderer2.sh ${ORDERER_TYPE} > ./logs/orderer2.log 2>&1 & - ./orderer3.sh ${ORDERER_TYPE} > ./logs/orderer3.log 2>&1 & + ./orderer1.sh "${ORDERER_TYPE}" > ./logs/orderer1.log 2>&1 & + ./orderer2.sh "${ORDERER_TYPE}" > ./logs/orderer2.log 2>&1 & + ./orderer3.sh "${ORDERER_TYPE}" > ./logs/orderer3.log 2>&1 & - # start one additional orderer for smartbft consensus - if [ "$ORDERER_TYPE" = "smartbft" ]; then - ./orderer4.sh ${ORDERER_TYPE} > ./logs/orderer4.log 2>&1 & + # start one additional orderer for BFT consensus + if [ "$ORDERER_TYPE" = "BFT" ]; then + ./orderer4.sh "${ORDERER_TYPE}" > ./logs/orderer4.log 2>&1 & fi echo "Waiting ${CLI_DELAY}s..." @@ -87,25 +87,25 @@ networkStart() { sleep ${CLI_DELAY} if [ "${CREATE_CHANNEL}" = "true" ]; then - if [ "$ORDERER_TYPE" = "smartbft" ]; then - echo "Joining orderers to channel..." - ../bin/osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9443 - ../bin/osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9444 - ../bin/osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9445 + echo "Joining orderers to channel..." + ../bin/osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9443 + ../bin/osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9444 + ../bin/osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9445 + if [ "$ORDERER_TYPE" = "BFT" ]; then ../bin/osnadmin channel join --channelID mychannel --config-block ./channel-artifacts/mychannel.block -o localhost:9446 - else - echo "Creating channel (peer1)..." - . ./peer1admin.sh && ./create_channel.sh - - echo "Joining channel (peer2)..." - . ./peer2admin.sh && ./join_channel.sh - - echo "Joining channel (peer3)..." - . ./peer3admin.sh && ./join_channel.sh - - echo "Joining channel (peer4)..." - . ./peer4admin.sh && ./join_channel.sh fi + + echo "Creating channel (peer1)..." + . ./peer1admin.sh && ./join_channel.sh + + echo "Joining channel (peer2)..." + . ./peer2admin.sh && ./join_channel.sh + + echo "Joining channel (peer3)..." + . ./peer3admin.sh && ./join_channel.sh + + echo "Joining channel (peer4)..." + . ./peer4admin.sh && ./join_channel.sh fi echo "Fabric network running. Use Ctrl-C to stop." diff --git a/test-network-nano-bash/orderer1.sh b/test-network-nano-bash/orderer1.sh index b4adb7ce..1176b6cd 100755 --- a/test-network-nano-bash/orderer1.sh +++ b/test-network-nano-bash/orderer1.sh @@ -17,17 +17,20 @@ export ORDERER_GENERAL_TLS_PRIVATEKEY="${PWD}"/crypto-config/ordererOrganization export ORDERER_GENERAL_TLS_CERTIFICATE="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt # following setting is not really needed at runtime since channel config has ca root certs, but we need to override the default in orderer.yaml export ORDERER_GENERAL_TLS_ROOTCAS="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt -if [ $# -gt 0 ] && [ "$1" = "smartbft" ] -then - export ORDERER_GENERAL_BOOTSTRAPMETHOD=none - export ORDERER_CHANNELPARTICIPATION_ENABLED=true -else - export ORDERER_GENERAL_BOOTSTRAPMETHOD=file - export ORDERER_GENERAL_BOOTSTRAPFILE="${PWD}"/channel-artifacts/genesis.block -fi +export ORDERER_GENERAL_BOOTSTRAPMETHOD=none +export ORDERER_CHANNELPARTICIPATION_ENABLED=true export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer -export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer/etcdraft/wal -export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer/etcdraft/wal +if [ $# -gt 0 ] +then + if [ "$1" != "BFT" ] && [ "$1" != "etcdraft" ] + then + echo "Unsupported input consensus type ${1}" + exit 1 + fi + export ORDERER_CONSENSUS_TYPE=${1} +fi +export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer/consensus/wal +export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer/consensus/snap export ORDERER_OPERATIONS_LISTENADDRESS=127.0.0.1:8443 export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9443 diff --git a/test-network-nano-bash/orderer2.sh b/test-network-nano-bash/orderer2.sh index 24932c24..c360477b 100755 --- a/test-network-nano-bash/orderer2.sh +++ b/test-network-nano-bash/orderer2.sh @@ -17,17 +17,20 @@ export ORDERER_GENERAL_TLS_PRIVATEKEY="${PWD}"/crypto-config/ordererOrganization export ORDERER_GENERAL_TLS_CERTIFICATE="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt # following setting is not really needed at runtime since channel config has ca root certs, but we need to override the default in orderer.yaml export ORDERER_GENERAL_TLS_ROOTCAS="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/ca.crt -if [ $# -gt 0 ] && [ "$1" = "smartbft" ] -then - export ORDERER_GENERAL_BOOTSTRAPMETHOD=none - export ORDERER_CHANNELPARTICIPATION_ENABLED=true -else - export ORDERER_GENERAL_BOOTSTRAPMETHOD=file - export ORDERER_GENERAL_BOOTSTRAPFILE="${PWD}"/channel-artifacts/genesis.block -fi +export ORDERER_GENERAL_BOOTSTRAPMETHOD=none +export ORDERER_CHANNELPARTICIPATION_ENABLED=true export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer2 -export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer2/etcdraft/wal -export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer2/etcdraft/wal +if [ $# -gt 0 ] +then + if [ "$1" != "BFT" ] && [ "$1" != "etcdraft" ] + then + echo "Unsupported input consensus type ${1}" + exit 1 + fi + export ORDERER_CONSENSUS_TYPE=${1} +fi +export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer2/consensus/wal +export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer2/consensus/snap export ORDERER_OPERATIONS_LISTENADDRESS=127.0.0.1:8444 export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9444 diff --git a/test-network-nano-bash/orderer3.sh b/test-network-nano-bash/orderer3.sh index 74ab828c..5151ee4d 100755 --- a/test-network-nano-bash/orderer3.sh +++ b/test-network-nano-bash/orderer3.sh @@ -17,17 +17,20 @@ export ORDERER_GENERAL_TLS_PRIVATEKEY="${PWD}"/crypto-config/ordererOrganization export ORDERER_GENERAL_TLS_CERTIFICATE="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt # following setting is not really needed at runtime since channel config has ca root certs, but we need to override the default in orderer.yaml export ORDERER_GENERAL_TLS_ROOTCAS="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/ca.crt -if [ $# -gt 0 ] && [ "$1" = "smartbft" ] -then - export ORDERER_GENERAL_BOOTSTRAPMETHOD=none - export ORDERER_CHANNELPARTICIPATION_ENABLED=true -else - export ORDERER_GENERAL_BOOTSTRAPMETHOD=file - export ORDERER_GENERAL_BOOTSTRAPFILE="${PWD}"/channel-artifacts/genesis.block -fi +export ORDERER_GENERAL_BOOTSTRAPMETHOD=none +export ORDERER_CHANNELPARTICIPATION_ENABLED=true export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer3 -export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer3/etcdraft/wal -export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer3/etcdraft/wal +if [ $# -gt 0 ] +then + if [ "$1" != "BFT" ] && [ "$1" != "etcdraft" ] + then + echo "Unsupported input consensus type ${1}" + exit 1 + fi + export ORDERER_CONSENSUS_TYPE=${1} +fi +export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer3/consensus/wal +export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer3/consensus/snap export ORDERER_OPERATIONS_LISTENADDRESS=127.0.0.1:8445 export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9445 diff --git a/test-network-nano-bash/orderer4.sh b/test-network-nano-bash/orderer4.sh index 19fdee9d..0a118c67 100755 --- a/test-network-nano-bash/orderer4.sh +++ b/test-network-nano-bash/orderer4.sh @@ -17,17 +17,20 @@ export ORDERER_GENERAL_TLS_PRIVATEKEY="${PWD}"/crypto-config/ordererOrganization export ORDERER_GENERAL_TLS_CERTIFICATE="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt # following setting is not really needed at runtime since channel config has ca root certs, but we need to override the default in orderer.yaml export ORDERER_GENERAL_TLS_ROOTCAS="${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/ca.crt -if [ $# -gt 0 ] && [ "$1" = "smartbft" ] -then - export ORDERER_GENERAL_BOOTSTRAPMETHOD=none - export ORDERER_CHANNELPARTICIPATION_ENABLED=true -else - export ORDERER_GENERAL_BOOTSTRAPMETHOD=file - export ORDERER_GENERAL_BOOTSTRAPFILE="${PWD}"/channel-artifacts/genesis.block -fi +export ORDERER_GENERAL_BOOTSTRAPMETHOD=none +export ORDERER_CHANNELPARTICIPATION_ENABLED=true export ORDERER_FILELEDGER_LOCATION="${PWD}"/data/orderer4 -export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer4/etcdraft/wal -export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer4/etcdraft/wal +if [ $# -gt 0 ] +then + if [ "$1" != "BFT" ] && [ "$1" != "etcdraft" ] + then + echo "Unsupported input consensus type ${1}" + exit 1 + fi + export ORDERER_CONSENSUS_TYPE=${1} +fi +export ORDERER_CONSENSUS_WALDIR="${PWD}"/data/orderer4/consensus/wal +export ORDERER_CONSENSUS_SNAPDIR="${PWD}"/data/orderer4/consensus/snap export ORDERER_OPERATIONS_LISTENADDRESS=127.0.0.1:8450 export ORDERER_ADMIN_LISTENADDRESS=127.0.0.1:9446