Skip to content

Commit

Permalink
e2e: disconnect maverick (#6099)
Browse files Browse the repository at this point in the history
(cherry picked from commit d4b0477)
  • Loading branch information
cmwaters authored and liamsi committed Apr 20, 2021
1 parent ff85aec commit ee37afd
Show file tree
Hide file tree
Showing 19 changed files with 71 additions and 8,433 deletions.
81 changes: 40 additions & 41 deletions test/e2e/app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"os"
"path/filepath"
"strconv"
"time"

"github.com/spf13/viper"
Expand All @@ -19,8 +18,6 @@ import (
"github.com/lazyledger/lazyledger-core/p2p"
"github.com/lazyledger/lazyledger-core/privval"
"github.com/lazyledger/lazyledger-core/proxy"
mcs "github.com/lazyledger/lazyledger-core/test/maverick/consensus"
maverick "github.com/lazyledger/lazyledger-core/test/maverick/node"
)

var logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout))
Expand Down Expand Up @@ -62,11 +59,12 @@ func run(configFile string) error {
// Start app server.
switch cfg.Protocol {
case "builtin":
if len(cfg.Misbehaviors) == 0 {
err = startNode(cfg)
} else {
err = startMaverick(cfg)
}
// FIXME: Temporarily remove maverick until it is redesigned
// if len(cfg.Misbehaviors) == 0 {
err = startNode(cfg)
// } else {
// err = startMaverick(cfg)
// }
default:
err = fmt.Errorf("invalid protocol %q", cfg.Protocol)
}
Expand Down Expand Up @@ -114,41 +112,42 @@ func startNode(cfg *Config) error {
return n.Start()
}

// FIXME: Temporarily disconnected maverick until it is redesigned
// startMaverick starts a Maverick node that runs the application directly. It assumes the Tendermint
// configuration is in $TMHOME/config/tendermint.toml.
func startMaverick(cfg *Config) error {
app, err := NewApplication(cfg)
if err != nil {
return err
}

tmcfg, logger, nodeKey, err := setupNode()
if err != nil {
return fmt.Errorf("failed to setup config: %w", err)
}

misbehaviors := make(map[int64]mcs.Misbehavior, len(cfg.Misbehaviors))
for heightString, misbehaviorString := range cfg.Misbehaviors {
height, _ := strconv.ParseInt(heightString, 10, 64)
misbehaviors[height] = mcs.MisbehaviorList[misbehaviorString]
}

n, err := maverick.NewNode(tmcfg,
maverick.LoadOrGenFilePV(tmcfg.PrivValidatorKeyFile(), tmcfg.PrivValidatorStateFile()),
*nodeKey,
proxy.NewLocalClientCreator(app),
maverick.DefaultGenesisDocProviderFunc(tmcfg),
maverick.DefaultDBProvider,
maverick.DefaultMetricsProvider(tmcfg.Instrumentation),
logger,
misbehaviors,
)
if err != nil {
return err
}

return n.Start()
}
// func startMaverick(cfg *Config) error {
// app, err := NewApplication(cfg)
// if err != nil {
// return err
// }

// tmcfg, logger, nodeKey, err := setupNode()
// if err != nil {
// return fmt.Errorf("failed to setup config: %w", err)
// }

// misbehaviors := make(map[int64]mcs.Misbehavior, len(cfg.Misbehaviors))
// for heightString, misbehaviorString := range cfg.Misbehaviors {
// height, _ := strconv.ParseInt(heightString, 10, 64)
// misbehaviors[height] = mcs.MisbehaviorList[misbehaviorString]
// }

// n, err := maverick.NewNode(tmcfg,
// maverick.LoadOrGenFilePV(tmcfg.PrivValidatorKeyFile(), tmcfg.PrivValidatorStateFile()),
// *nodeKey,
// proxy.NewLocalClientCreator(app),
// maverick.DefaultGenesisDocProviderFunc(tmcfg),
// maverick.DefaultDBProvider,
// maverick.DefaultMetricsProvider(tmcfg.Instrumentation),
// logger,
// misbehaviors,
// )
// if err != nil {
// return err
// }

// return n.Start()
// }

// startSigner starts a signer server connecting to the given endpoint.
func startSigner(cfg *Config) error {
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ RUN go mod download
COPY . .
RUN make build && cp build/tendermint /usr/bin/tendermint
COPY test/e2e/docker/entrypoint* /usr/bin/
RUN cd test/e2e && make maverick && cp build/maverick /usr/bin/maverick
# FIXME: Temporarily disconnect maverick node until it is redesigned
# RUN cd test/e2e && make maverick && cp build/maverick /usr/bin/maverick
RUN cd test/e2e && make app && cp build/app /usr/bin/app

# Set up runtime directory. We don't use a separate runtime image since we need
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/networks/ci.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ seeds = ["seed01"]
seeds = ["seed01"]
snapshot_interval = 5
perturb = ["disconnect"]
misbehaviors = { 1018 = "double-prevote" }
# FIXME: maverick has been disabled until it is redesigned (https://github.com/tendermint/tendermint/issues/5575)
# misbehaviors = { 1018 = "double-prevote" }

[node.validator02]
seeds = ["seed02"]
Expand Down
12 changes: 6 additions & 6 deletions test/e2e/pkg/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/lazyledger/lazyledger-core/crypto/ed25519"
"github.com/lazyledger/lazyledger-core/crypto/secp256k1"
rpchttp "github.com/lazyledger/lazyledger-core/rpc/client/http"
mcs "github.com/lazyledger/lazyledger-core/test/maverick/consensus"
"github.com/lazyledger/lazyledger-core/types"
)

Expand Down Expand Up @@ -356,11 +355,12 @@ func (n Node) Validate(testnet Testnet) error {
height, testnet.InitialHeight)
}
exists := false
for possibleBehaviors := range mcs.MisbehaviorList {
if possibleBehaviors == misbehavior {
exists = true
}
}
// FIXME: Maverick has been disabled until it is redesigned
// for possibleBehaviors := range mcs.MisbehaviorList {
// if possibleBehaviors == misbehavior {
// exists = true
// }
// }
if !exists {
return fmt.Errorf("misbehavior %s does not exist", misbehavior)
}
Expand Down
35 changes: 21 additions & 14 deletions test/e2e/runner/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,24 @@ func Setup(testnet *e2e.Testnet) error {
func MakeDockerCompose(testnet *e2e.Testnet) ([]byte, error) {
// Must use version 2 Docker Compose format, to support IPv6.
tmpl, err := template.New("docker-compose").Funcs(template.FuncMap{
"misbehaviorsToString": func(misbehaviors map[int64]string) string {
str := ""
for height, misbehavior := range misbehaviors {
// after the first behavior set, a comma must be prepended
if str != "" {
str += ","
}
heightString := strconv.Itoa(int(height))
str += misbehavior + "," + heightString
}
return str
"startCommands": func(misbehaviors map[int64]string, logLevel string) string {
command := "start"

// FIXME: Temporarily disable behaviors until maverick is redesigned
// misbehaviorString := ""
// for height, misbehavior := range misbehaviors {
// // after the first behavior set, a comma must be prepended
// if misbehaviorString != "" {
// misbehaviorString += ","
// }
// heightString := strconv.Itoa(int(height))
// misbehaviorString += misbehavior + "," + heightString
// }

// if misbehaviorString != "" {
// command += " --misbehaviors " + misbehaviorString
// }
return command
},
}).Parse(`version: '2.4'
Expand All @@ -164,9 +171,9 @@ services:
image: tendermint/e2e-node
{{- if eq .ABCIProtocol "builtin" }}
entrypoint: /usr/bin/entrypoint-builtin
{{- else if .Misbehaviors }}
entrypoint: /usr/bin/entrypoint-maverick
command: ["start", "--misbehaviors", "{{ misbehaviorsToString .Misbehaviors }}"]
{{- end }}
{{- if ne .ABCIProtocol "builtin"}}
command: {{ startCommands .Misbehaviors .LogLevel }}
{{- end }}
init: true
ports:
Expand Down
51 changes: 0 additions & 51 deletions test/maverick/README.md

This file was deleted.

Loading

0 comments on commit ee37afd

Please sign in to comment.