Skip to content

Commit

Permalink
test: investigate test failure due to wal log (#22679)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt authored Dec 19, 2024
1 parent 448b33d commit a9c1149
Show file tree
Hide file tree
Showing 71 changed files with 154 additions and 140 deletions.
4 changes: 2 additions & 2 deletions client/pruning/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"github.com/spf13/viper"

corestore "cosmossdk.io/core/store"
"cosmossdk.io/log"
pruningtypes "cosmossdk.io/store/pruning/types"
"cosmossdk.io/store/rootmulti"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/server"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
Expand Down Expand Up @@ -78,7 +78,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`,
// in our test, it's important to close db explicitly for pebbledb to write to disk.
defer db.Close()

logger := log.NewLogger(cmd.OutOrStdout())
logger := client.GetLoggerFromCmd(cmd)
app := appCreator(logger, db, nil, vp)
cms := app.CommitMultiStore()

Expand Down
8 changes: 3 additions & 5 deletions client/snapshot/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package snapshot
import (
"github.com/spf13/cobra"

"cosmossdk.io/log"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/server"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
)
Expand All @@ -17,20 +16,19 @@ func ExportSnapshotCmd[T servertypes.Application](appCreator servertypes.AppCrea
Short: "Export app state to snapshot store",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
cfg := client.GetConfigFromCmd(cmd)
viper := client.GetViperFromCmd(cmd)
logger := client.GetLoggerFromCmd(cmd)

height, err := cmd.Flags().GetInt64("height")
if err != nil {
return err
}

home := cfg.RootDir
home := viper.GetString(flags.FlagHome)
db, err := openDB(home, server.GetAppDBBackend(viper))
if err != nil {
return err
}
logger := log.NewLogger(cmd.OutOrStdout())
app := appCreator(logger, db, nil, viper)

if height == 0 {
Expand Down
5 changes: 5 additions & 0 deletions client/snapshot/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ var ListSnapshotsCmd = &cobra.Command{
if err != nil {
return fmt.Errorf("failed to list snapshots: %w", err)
}

if len(snapshots) == 0 {
cmd.Println("no snapshots found")
}

for _, snapshot := range snapshots {
cmd.Println("height:", snapshot.Height, "format:", snapshot.Format, "chunks:", snapshot.Chunks)
}
Expand Down
7 changes: 3 additions & 4 deletions client/snapshot/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"github.com/spf13/cobra"

corestore "cosmossdk.io/core/store"
"cosmossdk.io/log"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/server"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
)
Expand All @@ -23,8 +23,8 @@ func RestoreSnapshotCmd[T servertypes.Application](appCreator servertypes.AppCre
Long: "Restore app state from local snapshot",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
cfg := client.GetConfigFromCmd(cmd)
viper := client.GetViperFromCmd(cmd)
logger := client.GetLoggerFromCmd(cmd)

height, err := strconv.ParseUint(args[0], 10, 64)
if err != nil {
Expand All @@ -35,12 +35,11 @@ func RestoreSnapshotCmd[T servertypes.Application](appCreator servertypes.AppCre
return err
}

home := cfg.RootDir
home := viper.GetString(flags.FlagHome)
db, err := openDB(home, server.GetAppDBBackend(viper))
if err != nil {
return err
}
logger := log.NewLogger(cmd.OutOrStdout())
app := appCreator(logger, db, nil, viper)

sm := app.SnapshotManager()
Expand Down
2 changes: 1 addition & 1 deletion client/v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ require (
github.com/cometbft/cometbft-db v1.0.1 // indirect
github.com/cometbft/cometbft/api v1.0.0
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-db v1.1.0 // indirect
github.com/cosmos/cosmos-db v1.1.1 // indirect
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/gogoproto v1.7.0
Expand Down
4 changes: 2 additions & 2 deletions client/v2/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk=
github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis=
github.com/cosmos/cosmos-db v1.1.0 h1:KLHNVQ73h7vawXTpj9UJ7ZR2IXv51tsEHkQJJ9EBDzI=
github.com/cosmos/cosmos-db v1.1.0/go.mod h1:t7c4A6cfGdpUwwVxrQ0gQLeRQqGUBJu0yvE4F/26REg=
github.com/cosmos/cosmos-db v1.1.1 h1:FezFSU37AlBC8S98NlSagL76oqBRWq/prTPvFcEJNCM=
github.com/cosmos/cosmos-db v1.1.1/go.mod h1:AghjcIPqdhSLP/2Z0yha5xPH3nLnskz81pBx3tcVSAw=
github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
github.com/cometbft/cometbft v1.0.0
github.com/cometbft/cometbft/api v1.0.0
github.com/cosmos/btcutil v1.0.5
github.com/cosmos/cosmos-db v1.1.0
github.com/cosmos/cosmos-db v1.1.1
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogogateway v1.2.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk=
github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis=
github.com/cosmos/cosmos-db v1.1.0 h1:KLHNVQ73h7vawXTpj9UJ7ZR2IXv51tsEHkQJJ9EBDzI=
github.com/cosmos/cosmos-db v1.1.0/go.mod h1:t7c4A6cfGdpUwwVxrQ0gQLeRQqGUBJu0yvE4F/26REg=
github.com/cosmos/cosmos-db v1.1.1 h1:FezFSU37AlBC8S98NlSagL76oqBRWq/prTPvFcEJNCM=
github.com/cosmos/cosmos-db v1.1.1/go.mod h1:AghjcIPqdhSLP/2Z0yha5xPH3nLnskz81pBx3tcVSAw=
github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
Expand Down
4 changes: 1 addition & 3 deletions server/cmt_cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import (
"github.com/spf13/cobra"
"sigs.k8s.io/yaml"

"cosmossdk.io/log"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/rpc"
Expand Down Expand Up @@ -371,7 +369,7 @@ func BootstrapStateCmd[T types.Application](appCreator types.AppCreator[T]) *cob
Example: "bootstrap-state --height 1000000",
RunE: func(cmd *cobra.Command, args []string) error {
serverCtx := GetServerContextFromCmd(cmd)
logger := log.NewLogger(cmd.OutOrStdout())
logger := client.GetLoggerFromCmd(cmd)
cfg := serverCtx.Config

height, err := cmd.Flags().GetInt64("height")
Expand Down
2 changes: 1 addition & 1 deletion server/v2/api/telemetry/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package telemetry
func DefaultConfig() *Config {
return &Config{
Enable: true,
Address: "localhost:1327",
Address: "localhost:7180",
ServiceName: "",
EnableHostname: false,
EnableHostnameLabel: false,
Expand Down
4 changes: 2 additions & 2 deletions server/v2/cometbft/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk=
github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis=
github.com/cosmos/cosmos-db v1.1.0 h1:KLHNVQ73h7vawXTpj9UJ7ZR2IXv51tsEHkQJJ9EBDzI=
github.com/cosmos/cosmos-db v1.1.0/go.mod h1:t7c4A6cfGdpUwwVxrQ0gQLeRQqGUBJu0yvE4F/26REg=
github.com/cosmos/cosmos-db v1.1.1 h1:FezFSU37AlBC8S98NlSagL76oqBRWq/prTPvFcEJNCM=
github.com/cosmos/cosmos-db v1.1.1/go.mod h1:AghjcIPqdhSLP/2Z0yha5xPH3nLnskz81pBx3tcVSAw=
github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
Expand Down
8 changes: 5 additions & 3 deletions server/v2/stf/stf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ func TestSTF(t *testing.T) {
if len(events) != 7 {
t.Fatalf("Expected 7 TxEvents, got %d", len(events))
}

const message = "message"
for i, event := range events {
if event.BlockStage != appdata.TxProcessingStage {
t.Errorf("Expected BlockStage %d, got %d", appdata.TxProcessingStage, event.BlockStage)
Expand All @@ -236,7 +238,7 @@ func TestSTF(t *testing.T) {
t.Errorf("Expected TxIndex 1, got %d", event.TxIndex)
}
if event.EventIndex != int32(i%2+1) &&
(event.Type == "message" && event.EventIndex != 3) { // special case for message event type as it happens in the msg handling flow
(event.Type == message && event.EventIndex != 3) { // special case for message event type as it happens in the msg handling flow
t.Errorf("Expected EventIndex %d, got %d", i%2+1, event.EventIndex)
}

Expand All @@ -248,7 +250,7 @@ func TestSTF(t *testing.T) {
t.Errorf("Expected 1 or 2 attributes, got %d", len(attrs))
}

if len(attrs) == 2 && event.Type != "message" {
if len(attrs) == 2 && event.Type != message {
if attrs[1].Key != "index" || attrs[1].Value != "2" {
t.Errorf("Expected attribute key 'index' and value '2', got key '%s' and value '%s'", attrs[1].Key, attrs[1].Value)
}
Expand All @@ -275,7 +277,7 @@ func TestSTF(t *testing.T) {
t.Errorf("Expected msg attribute with value '&BoolValue{Value:true,XXX_unrecognized:[],}', got '%s'", attrs[0].Value)
}
case 4:
if event.Type != "message" {
if event.Type != message {
t.Errorf("Expected event type 'message', got %s", event.Type)
}

Expand Down
3 changes: 1 addition & 2 deletions server/v2/store/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`,
if err := vp.BindPFlags(cmd.PersistentFlags()); err != nil {
return err
}

logger := log.NewLogger(cmd.OutOrStdout())
logger := serverv2.GetLoggerFromCmd(cmd)

rootStore, opts, err := createRootStore(vp, logger)
if err != nil {
Expand Down
10 changes: 7 additions & 3 deletions server/v2/store/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (s *Server[T]) ExportSnapshotCmd() *cobra.Command {
return err
}

logger := log.NewLogger(cmd.OutOrStdout())
logger := serverv2.GetLoggerFromCmd(cmd)
rootStore, _, err := createRootStore(v, logger)
if err != nil {
return err
Expand Down Expand Up @@ -83,6 +83,7 @@ func (s *Server[T]) RestoreSnapshotCmd() *cobra.Command {
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
v := serverv2.GetViperFromCmd(cmd)
logger := serverv2.GetLoggerFromCmd(cmd)

height, err := strconv.ParseUint(args[0], 10, 64)
if err != nil {
Expand All @@ -93,8 +94,6 @@ func (s *Server[T]) RestoreSnapshotCmd() *cobra.Command {
return err
}

logger := log.NewLogger(cmd.OutOrStdout())

rootStore, _, err := createRootStore(v, logger)
if err != nil {
return fmt.Errorf("failed to create root store: %w", err)
Expand Down Expand Up @@ -128,6 +127,11 @@ func (s *Server[T]) ListSnapshotsCmd() *cobra.Command {
if err != nil {
return fmt.Errorf("failed to list snapshots: %w", err)
}

if len(snapshots) == 0 {
cmd.Println("no snapshots found")
}

for _, snapshot := range snapshots {
cmd.Println("height:", snapshot.Height, "format:", snapshot.Format, "chunks:", snapshot.Chunks)
}
Expand Down
2 changes: 0 additions & 2 deletions server/v2/testdata/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ minimum-gas-prices = '0stake'
app-db-backend = 'goleveldb'

[store.options]
# State storage database type. Currently we support: "pebble" and "rocksdb"
ss-type = 'pebble'
# State commitment database type. Currently we support: "iavl" and "iavl-v2"
sc-type = 'iavl'

Expand Down
2 changes: 1 addition & 1 deletion simapp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ require (
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cometbft/cometbft-db v1.0.1 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-db v1.1.0 // indirect
github.com/cosmos/cosmos-db v1.1.1 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions simapp/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk=
github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis=
github.com/cosmos/cosmos-db v1.1.0 h1:KLHNVQ73h7vawXTpj9UJ7ZR2IXv51tsEHkQJJ9EBDzI=
github.com/cosmos/cosmos-db v1.1.0/go.mod h1:t7c4A6cfGdpUwwVxrQ0gQLeRQqGUBJu0yvE4F/26REg=
github.com/cosmos/cosmos-db v1.1.1 h1:FezFSU37AlBC8S98NlSagL76oqBRWq/prTPvFcEJNCM=
github.com/cosmos/cosmos-db v1.1.1/go.mod h1:AghjcIPqdhSLP/2Z0yha5xPH3nLnskz81pBx3tcVSAw=
github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
Expand Down
2 changes: 1 addition & 1 deletion simapp/v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ require (
github.com/cometbft/cometbft-db v1.0.1 // indirect
github.com/cometbft/cometbft/api v1.0.0 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-db v1.1.0 // indirect
github.com/cosmos/cosmos-db v1.1.1 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions simapp/v2/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk=
github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis=
github.com/cosmos/cosmos-db v1.1.0 h1:KLHNVQ73h7vawXTpj9UJ7ZR2IXv51tsEHkQJJ9EBDzI=
github.com/cosmos/cosmos-db v1.1.0/go.mod h1:t7c4A6cfGdpUwwVxrQ0gQLeRQqGUBJu0yvE4F/26REg=
github.com/cosmos/cosmos-db v1.1.1 h1:FezFSU37AlBC8S98NlSagL76oqBRWq/prTPvFcEJNCM=
github.com/cosmos/cosmos-db v1.1.1/go.mod h1:AghjcIPqdhSLP/2Z0yha5xPH3nLnskz81pBx3tcVSAw=
github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
Expand Down
11 changes: 11 additions & 0 deletions store/v2/db/pebbledb.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func NewPebbleDB(name, dataDir string) (*PebbleDB, error) {

func NewPebbleDBWithOpts(name, dataDir string, opts coreserver.DynamicConfig) (*PebbleDB, error) {
do := &pebble.Options{
Logger: &fatalLogger{}, // pebble info logs are messing up the logs (not a cosmossdk.io/log logger)
MaxConcurrentCompactions: func() int { return 3 }, // default 1
}

Expand Down Expand Up @@ -301,3 +302,13 @@ func (b *pebbleDBBatch) Close() error {
func (b *pebbleDBBatch) GetByteSize() (int, error) {
return b.batch.Len(), nil
}

type fatalLogger struct {
pebble.Logger
}

func (*fatalLogger) Fatalf(format string, args ...interface{}) {
pebble.DefaultLogger.Fatalf(format, args...)
}

func (*fatalLogger) Infof(format string, args ...interface{}) {}
4 changes: 4 additions & 0 deletions systemtests/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ Ref: https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.j

## [Unreleased]

## [v1.0.0] - 2024-12-19

* [#22849](https://github.com/cosmos/cosmos-sdk/pull/22849) Avoid telemetry server conflicts on port 7180

## [v1.0.0-rc.4] - 2024-12-10

* [#22810](https://github.com/cosmos/cosmos-sdk/pull/22810) Avoid HTTP server conflicts on port 8080
Expand Down
12 changes: 7 additions & 5 deletions systemtests/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ var (

MaxGas = 10_000_000
// DefaultApiPort is the port for the node to interact with
DefaultApiPort = 1317
DefaultRpcPort = 26657
DefaultRestPort = 8080
DefaultGrpcPort = 9090
DefaultP2PPort = 16656
DefaultApiPort = 1317
DefaultRpcPort = 26657
DefaultTelemetryPort = 7180
DefaultRestPort = 8080
DefaultGrpcPort = 9090
DefaultP2PPort = 16656
)

type TestnetInitializer interface {
Expand Down Expand Up @@ -737,6 +738,7 @@ func (s *SystemUnderTest) AddFullnode(t *testing.T, beforeStart ...func(nodeNumb
EditToml(file, func(doc *tomledit.Document) {
SetValue(doc, fmt.Sprintf("%s:%d", node.IP, DefaultApiPort+nodeNumber), "grpc-gateway", "address")
SetValue(doc, fmt.Sprintf("%s:%d", node.IP, DefaultRestPort+nodeNumber), "rest", "address")
SetValue(doc, fmt.Sprintf("%s:%d", node.IP, DefaultTelemetryPort+nodeNumber), "telemetry", "address")
})
}
}
Expand Down
1 change: 1 addition & 0 deletions systemtests/testnet_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ func (s ModifyConfigYamlInitializer) Initialize() {
copy(peers[nodeNumber:], nodeAddresses[nodeNumber+1:])
SetValue(doc, strings.Join(peers, ","), "p2p", "persistent_peers")
SetValue(doc, s.commitTimeout.String(), "consensus", "timeout_commit")
SetValue(doc, "goleveldb", "db_backend")
})
EditToml(filepath.Join(nodeDir, "app.toml"), func(doc *tomledit.Document) {
UpdatePort(doc, DefaultApiPort+i, "api", "address")
Expand Down
2 changes: 1 addition & 1 deletion tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ require (
cosmossdk.io/x/slashing v0.0.0-00010101000000-000000000000
cosmossdk.io/x/staking v0.0.0-20240226161501-23359a0b6d91
github.com/cometbft/cometbft/api v1.0.0
github.com/cosmos/cosmos-db v1.1.0
github.com/cosmos/cosmos-db v1.1.1
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/go-cmp v0.6.0
github.com/google/gofuzz v1.2.0
Expand Down
4 changes: 2 additions & 2 deletions tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk=
github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis=
github.com/cosmos/cosmos-db v1.1.0 h1:KLHNVQ73h7vawXTpj9UJ7ZR2IXv51tsEHkQJJ9EBDzI=
github.com/cosmos/cosmos-db v1.1.0/go.mod h1:t7c4A6cfGdpUwwVxrQ0gQLeRQqGUBJu0yvE4F/26REg=
github.com/cosmos/cosmos-db v1.1.1 h1:FezFSU37AlBC8S98NlSagL76oqBRWq/prTPvFcEJNCM=
github.com/cosmos/cosmos-db v1.1.1/go.mod h1:AghjcIPqdhSLP/2Z0yha5xPH3nLnskz81pBx3tcVSAw=
github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
Expand Down
Loading

0 comments on commit a9c1149

Please sign in to comment.