@@ -667,6 +667,112 @@ var _ = Describe("EndToEnd Smart BFT configuration test", func() {
667
667
ordererProcesses [3 ] = proc
668
668
Eventually (proc .Ready (), network .EventuallyTimeout ).Should (BeClosed ())
669
669
Eventually (runner .Err (), network .EventuallyTimeout , time .Second ).Should (gbytes .Say ("Starting view with number 0, sequence 5" ))
670
+ Eventually (runner .Err (), network .EventuallyTimeout , time .Second ).Should (gbytes .Say ("BFTSynchronizer Sync initiated" ))
671
+
672
+ By ("Waiting communication to be established from the leader" )
673
+ Eventually (runner .Err (), network .EventuallyTimeout , time .Second ).Should (gbytes .Say ("Message from 1" ))
674
+ Eventually (runner .Err (), network .EventuallyTimeout , time .Second ).Should (gbytes .Say ("Message from 1" ))
675
+ Eventually (runner .Err (), network .EventuallyTimeout , time .Second ).Should (gbytes .Say ("Message from 1" ))
676
+
677
+ assertBlockReception (map [string ]int {"testchannel1" : 8 }, network .Orderers , peer , network )
678
+
679
+ invokeQuery (network , peer , orderer , channel , 50 )
680
+ time .Sleep (time .Second * 2 )
681
+ invokeQuery (network , peer , orderer , channel , 40 )
682
+ time .Sleep (time .Second * 2 )
683
+ invokeQuery (network , peer , orderer , channel , 30 )
684
+ time .Sleep (time .Second * 2 )
685
+ invokeQuery (network , peer , orderer , channel , 20 )
686
+ time .Sleep (time .Second * 2 )
687
+ invokeQuery (network , peer , orderer , channel , 10 )
688
+
689
+ By ("Submitting to orderer4" )
690
+ invokeQuery (network , peer , network .Orderers [3 ], channel , 0 )
691
+ assertBlockReception (map [string ]int {"testchannel1" : 14 }, network .Orderers , peer , network )
692
+
693
+ By ("Ensuring follower participates in consensus" )
694
+ Eventually (runner .Err (), network .EventuallyTimeout , time .Second ).Should (gbytes .Say ("Deciding on seq 14" ))
695
+ })
696
+
697
+ It ("smartbft assisted synchronization no rotation with simple replication policy" , func () {
698
+ networkConfig := nwo .MultiNodeSmartBFT ()
699
+ networkConfig .Channels = nil
700
+ channel := "testchannel1"
701
+
702
+ network = nwo .New (networkConfig , testDir , client , StartPort (), components )
703
+ network .OrdererReplicationPolicy = "simple"
704
+ network .GenerateConfigTree ()
705
+ network .Bootstrap ()
706
+
707
+ var ordererRunners []* ginkgomon.Runner
708
+ for _ , orderer := range network .Orderers {
709
+ runner := network .OrdererRunner (orderer )
710
+ runner .Command .Env = append (runner .Command .Env , "FABRIC_LOGGING_SPEC=orderer.consensus.smartbft=debug:grpc=debug" )
711
+ ordererRunners = append (ordererRunners , runner )
712
+ proc := ifrit .Invoke (runner )
713
+ ordererProcesses = append (ordererProcesses , proc )
714
+ Eventually (proc .Ready (), network .EventuallyTimeout ).Should (BeClosed ())
715
+ }
716
+
717
+ peerGroupRunner , _ := peerGroupRunners (network )
718
+ peerProcesses = ifrit .Invoke (peerGroupRunner )
719
+ Eventually (peerProcesses .Ready (), network .EventuallyTimeout ).Should (BeClosed ())
720
+ peer := network .Peer ("Org1" , "peer0" )
721
+
722
+ By ("Join channel" )
723
+ joinChannel (network , channel )
724
+
725
+ By ("Waiting for followers to see the leader" )
726
+ Eventually (ordererRunners [1 ].Err (), network .EventuallyTimeout , time .Second ).Should (gbytes .Say ("Message from 1" ))
727
+ Eventually (ordererRunners [2 ].Err (), network .EventuallyTimeout , time .Second ).Should (gbytes .Say ("Message from 1" ))
728
+ Eventually (ordererRunners [3 ].Err (), network .EventuallyTimeout , time .Second ).Should (gbytes .Say ("Message from 1" ))
729
+
730
+ orderer := network .Orderers [0 ]
731
+
732
+ By ("Joining peers to testchannel1" )
733
+ network .JoinChannel (channel , network .Orderers [0 ], network .PeersWithChannel (channel )... )
734
+
735
+ assertBlockReception (map [string ]int {"testchannel1" : 0 }, network .Orderers , peer , network )
736
+
737
+ By ("Restarting all nodes" )
738
+ for i := 0 ; i < 4 ; i ++ {
739
+ orderer := network .Orderers [i ]
740
+ By (fmt .Sprintf ("Killing %s" , orderer .Name ))
741
+ ordererProcesses [i ].Signal (syscall .SIGTERM )
742
+ Eventually (ordererProcesses [i ].Wait (), network .EventuallyTimeout ).Should (Receive ())
743
+
744
+ By (fmt .Sprintf ("Launching %s" , orderer .Name ))
745
+ runner := network .OrdererRunner (orderer )
746
+ runner .Command .Env = append (runner .Command .Env , "FABRIC_LOGGING_SPEC=orderer.consensus.smartbft=debug:policies.ImplicitOrderer=debug" )
747
+ ordererRunners [i ] = runner
748
+ proc := ifrit .Invoke (runner )
749
+ ordererProcesses [i ] = proc
750
+ Eventually (proc .Ready (), network .EventuallyTimeout ).Should (BeClosed ())
751
+ }
752
+
753
+ By ("Deploying chaincode" )
754
+ deployChaincode (network , channel , testDir )
755
+
756
+ assertBlockReception (map [string ]int {"testchannel1" : 4 }, network .Orderers , peer , network )
757
+
758
+ By ("Taking down a follower node" )
759
+ ordererProcesses [3 ].Signal (syscall .SIGTERM )
760
+ Eventually (ordererProcesses [3 ].Wait (), network .EventuallyTimeout ).Should (Receive ())
761
+
762
+ invokeQuery (network , peer , orderer , channel , 90 )
763
+ invokeQuery (network , peer , orderer , channel , 80 )
764
+ invokeQuery (network , peer , orderer , channel , 70 )
765
+ invokeQuery (network , peer , orderer , channel , 60 )
766
+
767
+ By ("Bringing up the follower node" )
768
+ runner := network .OrdererRunner (network .Orderers [3 ])
769
+ runner .Command .Env = append (runner .Command .Env , "FABRIC_LOGGING_SPEC=orderer.consensus.smartbft=debug:orderer.common.cluster.puller=debug" )
770
+ proc := ifrit .Invoke (runner )
771
+ ordererProcesses [3 ] = proc
772
+ Eventually (proc .Ready (), network .EventuallyTimeout ).Should (BeClosed ())
773
+ Eventually (runner .Err (), network .EventuallyTimeout , time .Second ).Should (gbytes .Say ("Starting view with number 0, sequence 5" ))
774
+ By ("Verifying the simple replication policy is used" )
775
+ Eventually (runner .Err (), network .EventuallyTimeout , time .Second ).Should (gbytes .Say ("Synchronizer Sync initiated" ))
670
776
671
777
By ("Waiting communication to be established from the leader" )
672
778
Eventually (runner .Err (), network .EventuallyTimeout , time .Second ).Should (gbytes .Say ("Message from 1" ))
@@ -1085,77 +1191,6 @@ var _ = Describe("EndToEnd Smart BFT configuration test", func() {
1085
1191
Expect (resp .Info ).To (ContainSubstring ("implicit policy evaluation failed - 0 sub-policies were satisfied" ))
1086
1192
})
1087
1193
1088
- It ("smartbft sync is called after restart" , func () {
1089
- channel := "testchannel1"
1090
- networkConfig := nwo .MultiNodeSmartBFT ()
1091
- networkConfig .Channels = nil
1092
-
1093
- network = nwo .New (networkConfig , testDir , client , StartPort (), components )
1094
- network .OrdererReplicationPolicy = "simple"
1095
- network .GenerateConfigTree ()
1096
- network .Bootstrap ()
1097
-
1098
- network .EventuallyTimeout *= 2
1099
- fabricLoggingSpec := "FABRIC_LOGGING_SPEC=debug"
1100
-
1101
- var ordererRunners []* ginkgomon.Runner
1102
- for _ , orderer := range network .Orderers {
1103
- runner := network .OrdererRunner (orderer )
1104
- runner .Command .Env = append (runner .Command .Env , fabricLoggingSpec )
1105
- ordererRunners = append (ordererRunners , runner )
1106
- proc := ifrit .Invoke (runner )
1107
- ordererProcesses = append (ordererProcesses , proc )
1108
- Eventually (proc .Ready (), network .EventuallyTimeout ).Should (BeClosed ())
1109
- }
1110
-
1111
- peerRunner := network .PeerGroupRunner ()
1112
- peerProcesses = ifrit .Invoke (peerRunner )
1113
-
1114
- Eventually (peerProcesses .Ready (), network .EventuallyTimeout ).Should (BeClosed ())
1115
-
1116
- peer := network .Peer ("Org1" , "peer0" )
1117
-
1118
- joinChannel (network , channel )
1119
-
1120
- By ("Waiting for followers to see the leader" )
1121
- Eventually (ordererRunners [1 ].Err (), network .EventuallyTimeout , time .Second ).Should (gbytes .Say ("Message from 1" ))
1122
- Eventually (ordererRunners [2 ].Err (), network .EventuallyTimeout , time .Second ).Should (gbytes .Say ("Message from 1" ))
1123
- Eventually (ordererRunners [3 ].Err (), network .EventuallyTimeout , time .Second ).Should (gbytes .Say ("Message from 1" ))
1124
-
1125
- By ("Joining peers to channel" )
1126
- network .JoinChannel (channel , network .Orderers [0 ], network .PeersWithChannel (channel )... )
1127
-
1128
- By ("Deploying chaincode" )
1129
- deployChaincode (network , channel , testDir )
1130
- assertBlockReception (map [string ]int {channel : 4 }, network .Orderers , peer , network )
1131
-
1132
- leader := network .Orderers [0 ]
1133
- By ("Send TX" )
1134
- invokeQuery (network , peer , leader , channel , 90 )
1135
- assertBlockReception (map [string ]int {channel : 5 }, network .Orderers , peer , network )
1136
-
1137
- lastOrderer := network .Orderers [3 ]
1138
- lastOrdererProcess := ordererProcesses [3 ]
1139
-
1140
- By ("Stop last orderer" )
1141
- lastOrdererProcess .Signal (syscall .SIGTERM )
1142
- Eventually (lastOrdererProcess .Wait (), network .EventuallyTimeout ).Should (Receive ())
1143
-
1144
- By ("Send another TX" )
1145
- invokeQuery (network , peer , leader , channel , 80 )
1146
- assertBlockReception (map [string ]int {channel : 6 }, network .Orderers [:3 ], peer , network )
1147
-
1148
- By ("Restart the follower" )
1149
- runner := network .OrdererRunner (lastOrderer )
1150
- runner .Command .Env = append (runner .Command .Env , fabricLoggingSpec )
1151
- ordererRunners [3 ] = runner
1152
- proc := ifrit .Invoke (runner )
1153
- ordererProcesses [3 ] = proc
1154
- Eventually (proc .Ready (), network .EventuallyTimeout ).Should (BeClosed ())
1155
- // Eventually(runner.Err(), network.EventuallyTimeout, time.Second).Should(gbytes.Say("Synchronizer Sync initiated"))
1156
- assertBlockReception (map [string ]int {channel : 6 }, network .Orderers , peer , network )
1157
- })
1158
-
1159
1194
It ("smartbft batch size max bytes config change" , func () {
1160
1195
channel := "testchannel1"
1161
1196
By ("Create network" )
0 commit comments