Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove maverick directory #1465

Open
wants to merge 3 commits into
base: v0.34.x-celestia
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ test/loadtime/build
test/e2e/build
test/e2e/networks/*/
test/logs
test/maverick/maverick
test/p2p/data/
vendor
test/fuzz/**/corpus
Expand Down
7 changes: 1 addition & 6 deletions test/e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,11 @@ docker:
# ABCI testing).
node:
go build -o build/node -tags badgerdb,boltdb,cleveldb,rocksdb ./node

# To be used primarily by the e2e docker instance. If you want to produce this binary
# elsewhere, then run go build in the maverick directory.
maverick:
go build -o build/maverick -tags badgerdb,boltdb,cleveldb,rocksdb ../maverick

generator:
go build -o build/generator ./generator

runner:
go build -o build/runner ./runner

.PHONY: all node docker generator maverick runner
.PHONY: all node docker generator runner
3 changes: 1 addition & 2 deletions test/e2e/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apt-get -qq update -y && apt-get -qq upgrade -y >/dev/null
RUN apt-get -qq install -y libleveldb-dev librocksdb-dev >/dev/null

# Set up build directory /src/cometbft
ENV COMETBFT_BUILD_OPTIONS badgerdb,boltdb,cleveldb,rocksdb
ENV COMETBFT_BUILD_OPTIONS=badgerdb,boltdb,cleveldb,rocksdb
WORKDIR /src/cometbft

# Fetch dependencies separately (for layer caching)
Expand All @@ -18,7 +18,6 @@ RUN go mod download
COPY . .
RUN make build && cp build/cometbft /usr/bin/cometbft
COPY test/e2e/docker/entrypoint* /usr/bin/
RUN cd test/e2e && make maverick && cp build/maverick /usr/bin/maverick
RUN cd test/e2e && make node && cp build/node /usr/bin/app

# Set up runtime directory. We don't use a separate runtime image since we need
Expand Down
10 changes: 0 additions & 10 deletions test/e2e/docker/entrypoint-maverick

This file was deleted.

31 changes: 0 additions & 31 deletions test/e2e/generator/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,6 @@ var (
"restart": 0.1,
"upgrade": 0.3,
}
nodeMisbehaviors = weightedChoice{
// FIXME: evidence disabled due to node panicking when not
// having sufficient block history to process evidence.
// https://github.com/tendermint/tendermint/issues/5617
// misbehaviorOption{"double-prevote"}: 1,
misbehaviorOption{}: 9,
}
lightNodePerturbations = probSetChoice{
"upgrade": 0.3,
}
Expand Down Expand Up @@ -293,17 +286,6 @@ func generateNode(
node.SnapshotInterval = 3
}

if node.Mode == string(e2e.ModeValidator) {
misbehaveAt := startAt + 5 + int64(r.Intn(10))
if startAt == 0 {
misbehaveAt += initialHeight - 1
}
node.Misbehaviors = nodeMisbehaviors.Choose(r).(misbehaviorOption).atHeight(misbehaveAt)
if len(node.Misbehaviors) != 0 {
node.PrivvalProtocol = "file"
}
}

// If a node which does not persist state also does not retain blocks, randomly
// choose to either persist state or retain all blocks.
if node.PersistInterval != nil && *node.PersistInterval == 0 && node.RetainBlocks > 0 {
Expand Down Expand Up @@ -344,19 +326,6 @@ func ptrUint64(i uint64) *uint64 {
return &i
}

type misbehaviorOption struct {
misbehavior string
}

func (m misbehaviorOption) atHeight(height int64) map[string]string {
misbehaviorMap := make(map[string]string)
if m.misbehavior == "" {
return misbehaviorMap
}
misbehaviorMap[strconv.Itoa(int(height))] = m.misbehavior
return misbehaviorMap
}

// Parses strings like "v0.34.21:1,v0.34.22:2" to represent two versions
// ("v0.34.21" and "v0.34.22") with weights of 1 and 2 respectively.
// Versions may be specified as cometbft/e2e-node:v0.34.27-alpha.1:1 or
Expand Down
1 change: 0 additions & 1 deletion test/e2e/networks/ci.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ seeds = ["seed01"]
seeds = ["seed01"]
snapshot_interval = 5
perturb = ["disconnect"]
misbehaviors = { 1018 = "double-prevote" }

[node.validator02]
seeds = ["seed02"]
Expand Down
1 change: 0 additions & 1 deletion test/e2e/node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type Config struct {
PrivValServer string `toml:"privval_server"`
PrivValKey string `toml:"privval_key"`
PrivValState string `toml:"privval_state"`
Misbehaviors map[string]string `toml:"misbehaviors"`
KeyType string `toml:"key_type"`
}

Expand Down
50 changes: 3 additions & 47 deletions test/e2e/node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
"time"

Expand All @@ -30,8 +29,6 @@ import (
rpcserver "github.com/tendermint/tendermint/rpc/jsonrpc/server"
"github.com/tendermint/tendermint/test/e2e/app"
e2e "github.com/tendermint/tendermint/test/e2e/pkg"
mcs "github.com/tendermint/tendermint/test/maverick/consensus"
maverick "github.com/tendermint/tendermint/test/maverick/node"
)

var logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout))
Expand Down Expand Up @@ -75,14 +72,10 @@ func run(configFile string) error {
case "socket", "grpc":
err = startApp(cfg)
case "builtin":
if len(cfg.Misbehaviors) == 0 {
if cfg.Mode == string(e2e.ModeLight) {
err = startLightClient(cfg)
} else {
err = startNode(cfg)
}
if cfg.Mode == string(e2e.ModeLight) {
err = startLightClient(cfg)
} else {
err = startMaverick(cfg)
err = startNode(cfg)
}
default:
err = fmt.Errorf("invalid protocol %q", cfg.Protocol)
Expand Down Expand Up @@ -204,43 +197,6 @@ func startLightClient(cfg *Config) error {
return nil
}

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

cmtcfg, 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(cmtcfg,
maverick.LoadOrGenFilePV(cmtcfg.PrivValidatorKeyFile(), cmtcfg.PrivValidatorStateFile()),
nodeKey,
proxy.NewLocalClientCreator(app),
maverick.DefaultGenesisDocProviderFunc(cmtcfg),
maverick.DefaultDBProvider,
maverick.DefaultMetricsProvider(cmtcfg.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 {
filePV := privval.LoadFilePV(cfg.PrivValKey, cfg.PrivValState)
Expand Down
22 changes: 1 addition & 21 deletions test/e2e/pkg/infra/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"os"
"path/filepath"
"strconv"
"text/template"

e2e "github.com/tendermint/tendermint/test/e2e/pkg"
Expand Down Expand Up @@ -38,20 +37,7 @@ func (p *Provider) Setup() error {
// file as bytes to be written out to disk.
func dockerComposeBytes(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
},
}).Parse(`version: '2.4'
tmpl, err := template.New("docker-compose").Parse(`version: '2.4'

networks:
{{ .Name }}:
Expand All @@ -75,9 +61,6 @@ services:
image: {{ .Version }}
{{- if eq .ABCIProtocol "builtin" }}
entrypoint: /usr/bin/entrypoint-builtin
{{- else if .Misbehaviors }}
entrypoint: /usr/bin/entrypoint-maverick
command: ["node", "--misbehaviors", "{{ misbehaviorsToString .Misbehaviors }}"]
{{- end }}
init: true
ports:
Expand All @@ -102,9 +85,6 @@ services:
image: {{ $.UpgradeVersion }}
{{- if eq .ABCIProtocol "builtin" }}
entrypoint: /usr/bin/entrypoint-builtin
{{- else if .Misbehaviors }}
entrypoint: /usr/bin/entrypoint-maverick
command: ["node", "--misbehaviors", "{{ misbehaviorsToString .Misbehaviors }}"]
{{- end }}
init: true
ports:
Expand Down
10 changes: 0 additions & 10 deletions test/e2e/pkg/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,6 @@ type ManifestNode struct {
// restart: restarts the node, shutting it down with SIGTERM
Perturb []string `toml:"perturb"`

// Misbehaviors sets how a validator behaves during consensus at a
// certain height. Multiple misbehaviors at different heights can be used
//
// An example of misbehaviors
// { 10 = "double-prevote", 20 = "double-prevote"}
//
// For more information, look at the readme in the maverick folder.
// A list of all behaviors can be found in ../maverick/consensus/behavior.go
Misbehaviors map[string]string `toml:"misbehaviors"`

// SendNoLoad determines if the e2e test should send load to this node.
// It defaults to false so unless the configured, the node will
// receive load.
Expand Down
47 changes: 0 additions & 47 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/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/crypto/secp256k1"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
mcs "github.com/tendermint/tendermint/test/maverick/consensus"
)

const (
Expand Down Expand Up @@ -102,7 +101,6 @@ type Node struct {
Seeds []*Node
PersistentPeers []*Node
Perturbations []Perturbation
Misbehaviors map[int64]string
SendNoLoad bool
Prometheus bool
PrometheusProxyPort uint32
Expand Down Expand Up @@ -207,7 +205,6 @@ func LoadTestnet(manifest Manifest, fname string, ifd InfrastructureData) (*Test
SnapshotInterval: nodeManifest.SnapshotInterval,
RetainBlocks: nodeManifest.RetainBlocks,
Perturbations: []Perturbation{},
Misbehaviors: make(map[int64]string),
SendNoLoad: nodeManifest.SendNoLoad,
TracePushConfig: ifd.TracePushConfig,
TracePullAddress: ifd.TracePullAddress,
Expand Down Expand Up @@ -240,13 +237,6 @@ func LoadTestnet(manifest Manifest, fname string, ifd InfrastructureData) (*Test
for _, p := range nodeManifest.Perturb {
node.Perturbations = append(node.Perturbations, Perturbation(p))
}
for heightString, misbehavior := range nodeManifest.Misbehaviors {
height, err := strconv.ParseInt(heightString, 10, 64)
if err != nil {
return nil, fmt.Errorf("unable to parse height %s to int64: %w", heightString, err)
}
node.Misbehaviors[height] = misbehavior
}
testnet.Nodes = append(testnet.Nodes, node)
}

Expand Down Expand Up @@ -436,30 +426,6 @@ func (n Node) Validate(testnet Testnet) error {
}
}

if (n.PrivvalProtocol != "file" || n.Mode != "validator") && len(n.Misbehaviors) != 0 {
return errors.New("must be using \"file\" privval protocol to implement misbehaviors")
}

for height, misbehavior := range n.Misbehaviors {
if height < n.StartAt {
return fmt.Errorf("misbehavior height %d is below node start height %d",
height, n.StartAt)
}
if height < testnet.InitialHeight {
return fmt.Errorf("misbehavior height %d is below network initial height %d",
height, testnet.InitialHeight)
}
exists := false
for possibleBehaviors := range mcs.MisbehaviorList {
if possibleBehaviors == misbehavior {
exists = true
}
}
if !exists {
return fmt.Errorf("misbehavior %s does not exist", misbehavior)
}
}

return nil
}

Expand Down Expand Up @@ -512,19 +478,6 @@ func (t Testnet) HasPerturbations() bool {
return false
}

// LastMisbehaviorHeight returns the height of the last misbehavior.
func (t Testnet) LastMisbehaviorHeight() int64 {
lastHeight := int64(0)
for _, node := range t.Nodes {
for height := range node.Misbehaviors {
if height > lastHeight {
lastHeight = height
}
}
}
return lastHeight
}

// Address returns a P2P endpoint address for the node.
func (n Node) AddressP2P(withID bool) string {
ip := n.IP.String()
Expand Down
8 changes: 0 additions & 8 deletions test/e2e/runner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,6 @@ func NewCLI() *CLI {
return err
}

if lastMisbehavior := cli.testnet.LastMisbehaviorHeight(); lastMisbehavior > 0 {
// wait for misbehaviors before starting perturbations. We do a separate
// wait for another 5 blocks, since the last misbehavior height may be
// in the past depending on network startup ordering.
if err := WaitUntil(cli.testnet, lastMisbehavior); err != nil {
return err
}
}
if err := Wait(cli.testnet, 5); err != nil { // allow some txs to go through
return err
}
Expand Down
7 changes: 0 additions & 7 deletions test/e2e/runner/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -312,12 +311,6 @@ func MakeAppConfig(node *e2e.Node) ([]byte, error) {
}
}

misbehaviors := make(map[string]string)
for height, misbehavior := range node.Misbehaviors {
misbehaviors[strconv.Itoa(int(height))] = misbehavior
}
cfg["misbehaviors"] = misbehaviors

if len(node.Testnet.ValidatorUpdates) > 0 {
validatorUpdates := map[string]map[string]int64{}
for height, validators := range node.Testnet.ValidatorUpdates {
Expand Down
Loading
Loading