Skip to content

Commit

Permalink
fix: merge conflict resolution errors, fix testutil network
Browse files Browse the repository at this point in the history
  • Loading branch information
JeancarloBarrios committed Nov 25, 2024
1 parent 7c75937 commit 8557024
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 159 deletions.
28 changes: 17 additions & 11 deletions server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ const (
const (
defaultMinGasPrices = ""

// DefaultABCIClientType defines the default ABCI client type to use with cometbft.
DefaultABCIClientType = AbciClientTypeCommitting // [AGORIC]

// DefaultAPIAddress defines the default address to bind the API server to.
DefaultAPIAddress = "tcp://localhost:1317"

Expand All @@ -39,8 +36,8 @@ const (
// bytes the server can send.
DefaultGRPCMaxSendMsgSize = math.MaxInt32

// FileStreamer defines the store streaming type for file streaming.
FileStreamer = "file"
// DefaultABCIClientType defines the default ABCI client type to use with cometbft.
DefaultABCIClientType = AbciClientTypeCommitting // [AGORIC]
)

// BaseConfig defines the server's basic configuration
Expand Down Expand Up @@ -81,7 +78,7 @@ type BaseConfig struct {
// It has no bearing on application state pruning which is determined by the
// "pruning-*" configurations.
//
// Note: CometBFT block pruning is dependent on this parameter in conjunction
// Note: CometBFT block pruning is dependant on this parameter in conjunction
// with the unbonding (safety threshold) period, state pruning and state sync
// snapshot parameters to determine the correct minimum value of
// ResponseCommit.RetainHeight.
Expand All @@ -100,15 +97,15 @@ type BaseConfig struct {
// IAVLDisableFastNode enables or disables the fast sync node.
IAVLDisableFastNode bool `mapstructure:"iavl-disable-fastnode"`

// AppDBBackend defines the type of Database to use for the application and snapshots databases.
// An empty string indicates that the CometBFT config's DBBackend value should be used.
AppDBBackend string `mapstructure:"app-db-backend"`

// ABCIClientType selects the type of ABCI client.
// Valid settings are "committing" (default) or "local".
// The committing client allows greater query parallelism,
// but the local client is more defensive.
ABCIClientType string `mapstructure:"abci-client-type"`

// AppDBBackend defines the type of Database to use for the application and snapshots databases.
// An empty string indicates that the CometBFT config's DBBackend value should be used.
AppDBBackend string `mapstructure:"app-db-backend"`
}

// APIConfig defines the API listener configuration.
Expand Down Expand Up @@ -159,6 +156,12 @@ type GRPCConfig struct {
MaxSendMsgSize int `mapstructure:"max-send-msg-size"`
}

// GRPCWebConfig defines configuration for the gRPC-web server.
type GRPCWebConfig struct {
// Enable defines if the gRPC-web should be enabled.
Enable bool `mapstructure:"enable"`
}

// StateSyncConfig defines the state sync snapshot configuration.
type StateSyncConfig struct {
// SnapshotInterval sets the interval at which state sync snapshots are taken.
Expand Down Expand Up @@ -202,6 +205,7 @@ type Config struct {
Telemetry telemetry.Config `mapstructure:"telemetry"`
API APIConfig `mapstructure:"api"`
GRPC GRPCConfig `mapstructure:"grpc"`
GRPCWeb GRPCWebConfig `mapstructure:"grpc-web"`
StateSync StateSyncConfig `mapstructure:"state-sync"`
Streaming StreamingConfig `mapstructure:"streaming"`
Mempool MempoolConfig `mapstructure:"mempool"`
Expand Down Expand Up @@ -240,7 +244,6 @@ func DefaultConfig() *Config {
IndexEvents: make([]string, 0),
IAVLCacheSize: 781250,
IAVLDisableFastNode: false,
ABCIClientType: DefaultABCIClientType, // [AGORIC]
AppDBBackend: "",
},
Telemetry: telemetry.Config{
Expand All @@ -261,6 +264,9 @@ func DefaultConfig() *Config {
MaxRecvMsgSize: DefaultGRPCMaxRecvMsgSize,
MaxSendMsgSize: DefaultGRPCMaxSendMsgSize,
},
GRPCWeb: GRPCWebConfig{
Enable: true,
},
StateSync: StateSyncConfig{
SnapshotInterval: 0,
SnapshotKeepRecent: 2,
Expand Down
17 changes: 8 additions & 9 deletions testutil/key.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package testutil

import (
"errors"
"fmt"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"
)

// GenerateCoinKey generates a new key mnemonic along with its address.
// GenerateCoinKey generates a new key mnemonic along with its addrress.
func GenerateCoinKey(algo keyring.SignatureAlgo, cdc codec.Codec) (sdk.AccAddress, string, error) {
// generate a private key, with mnemonic
info, secret, err := keyring.NewInMemory(cdc).NewMnemonic(
"name",
keyring.English,
sdk.GetFullBIP44Path(),
sdk.GetConfig().GetFullBIP44Path(),
keyring.DefaultBIP39Passphrase,
algo,
)
Expand All @@ -28,7 +28,7 @@ func GenerateCoinKey(algo keyring.SignatureAlgo, cdc codec.Codec) (sdk.AccAddres
return addr, secret, nil
}

// GenerateSaveCoinKey generates a new key mnemonic with its address.
// GenerateSaveCoinKey generates a new key mnemonic with its addrress.
// If mnemonic is provided then it's used for key generation.
// The key is saved in the keyring. The function returns error if overwrite=true and the key
// already exists.
Expand All @@ -37,7 +37,6 @@ func GenerateSaveCoinKey(
keyName, mnemonic string,
overwrite bool,
algo keyring.SignatureAlgo,
hdPath string,
) (sdk.AccAddress, string, error) {
exists := false
_, err := keybase.Key(keyName)
Expand All @@ -47,12 +46,12 @@ func GenerateSaveCoinKey(

// ensure no overwrite
if !overwrite && exists {
return sdk.AccAddress{}, "", errors.New("key already exists, overwrite is disabled")
return sdk.AccAddress{}, "", fmt.Errorf("key already exists, overwrite is disabled")
}

if exists {
if err := keybase.Delete(keyName); err != nil {
return sdk.AccAddress{}, "", errors.New("failed to overwrite key")
return sdk.AccAddress{}, "", fmt.Errorf("failed to overwrite key")
}
}

Expand All @@ -64,9 +63,9 @@ func GenerateSaveCoinKey(
// generate or recover a new account
if mnemonic != "" {
secret = mnemonic
record, err = keybase.NewAccount(keyName, mnemonic, keyring.DefaultBIP39Passphrase, hdPath, algo)
record, err = keybase.NewAccount(keyName, mnemonic, keyring.DefaultBIP39Passphrase, sdk.GetConfig().GetFullBIP44Path(), algo)
} else {
record, secret, err = keybase.NewMnemonic(keyName, keyring.English, hdPath, keyring.DefaultBIP39Passphrase, algo)
record, secret, err = keybase.NewMnemonic(keyName, keyring.English, sdk.GetConfig().GetFullBIP44Path(), keyring.DefaultBIP39Passphrase, algo)
}
if err != nil {
return sdk.AccAddress{}, "", err
Expand Down
48 changes: 0 additions & 48 deletions testutil/network/interface.go

This file was deleted.

91 changes: 0 additions & 91 deletions testutil/network/validator.go

This file was deleted.

0 comments on commit 8557024

Please sign in to comment.