Skip to content

Commit

Permalink
Add networked stress tests for SBFT
Browse files Browse the repository at this point in the history
Change-Id: I185dd103b6deec8aeb2c99eeabebe9d4a34d9aa3
Signed-off-by: Gabor Hosszu <gabor@digitalasset.com>
  • Loading branch information
gaborh-da committed Dec 19, 2016
1 parent 38ba840 commit bfd7c84
Show file tree
Hide file tree
Showing 8 changed files with 456 additions and 17 deletions.
2 changes: 1 addition & 1 deletion orderer/common/deliver/deliver.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (d *deliverer) sendBlockReply(block *cb.Block) bool {

func (d *deliverer) processUpdate(update *ab.SeekInfo) bool {
d.cursor = nil // Even if the seek fails early, we should stop sending blocks from the last request
logger.Debugf("Updating properties for client")
logger.Debugf("Updating properties for client: %v", update)

if update == nil || update.WindowSize == 0 || update.WindowSize > uint64(d.ds.maxWindow) || update.ChainID == "" {
close(d.exitChan)
Expand Down
3 changes: 1 addition & 2 deletions orderer/sbft/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ import (
"sync"
"time"

"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/transport"

"crypto/ecdsa"
crand "crypto/rand"
"math/big"

"golang.org/x/net/context"

"crypto"
"crypto/rsa"
"crypto/sha256"
Expand Down
16 changes: 8 additions & 8 deletions orderer/sbft/main.go → orderer/sbft/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package sbft
package main

import (
"flag"
Expand All @@ -26,6 +26,7 @@ import (
"github.com/hyperledger/fabric/orderer/common/bootstrap/provisional"
localconfig "github.com/hyperledger/fabric/orderer/localconfig"
"github.com/hyperledger/fabric/orderer/rawledger/fileledger"
"github.com/hyperledger/fabric/orderer/sbft"
"github.com/hyperledger/fabric/orderer/sbft/backend"
"github.com/hyperledger/fabric/orderer/sbft/connection"
"github.com/hyperledger/fabric/orderer/sbft/persist"
Expand All @@ -47,6 +48,7 @@ type flags struct {
certFile string
keyFile string
dataDir string
genesisFile string
verbose string
init string
}
Expand All @@ -61,6 +63,7 @@ func main() {
flag.StringVar(&c.certFile, "cert", "", "certificate `file`")
flag.StringVar(&c.keyFile, "key", "", "key `file`")
flag.StringVar(&c.dataDir, "data-dir", "", "data `dir`ectory")
flag.StringVar(&c.genesisFile, "genesis-file", "", "`gen`esis block file")
flag.StringVar(&c.verbose, "verbose", "info", "set verbosity `level` (critical, error, warning, notice, info, debug)")

flag.Parse()
Expand All @@ -83,7 +86,7 @@ func main() {
}

func initInstance(c flags) error {
config, err := ReadJsonConfig(c.init)
config, err := sbft.ReadJsonConfig(c.init)
if err != nil {
return err
}
Expand All @@ -94,12 +97,12 @@ func initInstance(c flags) error {
}

p := persist.New(c.dataDir)
err = SaveConfig(p, config)
err = sbft.SaveConfig(p, config)
if err != nil {
return err
}

fmt.Println("initialized new peer")
fmt.Println(fmt.Sprintf("initialized new peer: listening at %v GRPC at %v", c.listenAddr, c.grpcAddr))
return nil
}

Expand All @@ -110,7 +113,7 @@ func serve(c flags) {
}

persist := persist.New(c.dataDir)
config, err := RestoreConfig(persist)
config, err := sbft.RestoreConfig(persist)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -145,7 +148,4 @@ func serve(c flags) {
broadcastab := backend.NewBackendAB(s.backend)
ab.RegisterAtomicBroadcastServer(grpcServer, broadcastab)
grpcServer.Serve(lis)

// block forever
select {}
}
Loading

0 comments on commit bfd7c84

Please sign in to comment.