func TestBaseConfig() BaseConfig {
	cfg := DefaultBaseConfig()
	cfg.chainID = "ostracon_test"
	cfg.ProxyApp = "kvstore"
	cfg.FastSyncMode = false
	cfg.DBBackend = "memdb"
	return cfg
}
TestBaseConfig returns a base configuration for testing an Ostracon node
package config
import (
	"encoding/hex"
	"errors"
	"fmt"
	"net/http"
	"os"
	"path/filepath"
	"time"
	"github.com/line/ostracon/privval"
	"github.com/line/tm-db/v2/metadb"
)
const (
	FuzzModeDrop = iota
	FuzzModeDelay
	LogFormatPlain = "plain"
	LogFormatJSON = "json"
	DefaultLogLevel = "info"
	DefaultDBBackend = "goleveldb"
)
var (
	DefaultOstraconDir = ".ostracon"
	defaultConfigDir   = "config"
	defaultDataDir     = "data"
	defaultConfigFileName  = "config.toml"
	defaultGenesisJSONName = "genesis.json"
	defaultPrivValKeyName   = "priv_validator_key.json"
	defaultPrivValStateName = "priv_validator_state.json"
	defaultNodeKeyName  = "node_key.json"
	defaultAddrBookName = "addrbook.json"
	defaultConfigFilePath   = filepath.Join(defaultConfigDir, defaultConfigFileName)
	defaultGenesisJSONPath  = filepath.Join(defaultConfigDir, defaultGenesisJSONName)
	defaultPrivValKeyPath   = filepath.Join(defaultConfigDir, defaultPrivValKeyName)
	defaultPrivValStatePath = filepath.Join(defaultDataDir, defaultPrivValStateName)
	defaultNodeKeyPath  = filepath.Join(defaultConfigDir, defaultNodeKeyName)
	defaultAddrBookPath = filepath.Join(defaultConfigDir, defaultAddrBookName)
)
type Config struct {
	BaseConfig `mapstructure:",squash"`
	RPC             *RPCConfig             `mapstructure:"rpc"`
	P2P             *P2PConfig             `mapstructure:"p2p"`
	Mempool         *MempoolConfig         `mapstructure:"mempool"`
	StateSync       *StateSyncConfig       `mapstructure:"statesync"`
	FastSync        *FastSyncConfig        `mapstructure:"fastsync"`
	Consensus       *ConsensusConfig       `mapstructure:"consensus"`
	TxIndex         *TxIndexConfig         `mapstructure:"tx_index"`
	Instrumentation *InstrumentationConfig `mapstructure:"instrumentation"`
}
func DefaultConfig() *Config {
	return &Config{
		BaseConfig:      DefaultBaseConfig(),
		RPC:             DefaultRPCConfig(),
		P2P:             DefaultP2PConfig(),
		Mempool:         DefaultMempoolConfig(),
		StateSync:       DefaultStateSyncConfig(),
		FastSync:        DefaultFastSyncConfig(),
		Consensus:       DefaultConsensusConfig(),
		TxIndex:         DefaultTxIndexConfig(),
		Instrumentation: DefaultInstrumentationConfig(),
	}
}
func TestConfig() *Config {
	return &Config{
		BaseConfig:      TestBaseConfig(),
		RPC:             TestRPCConfig(),
		P2P:             TestP2PConfig(),
		Mempool:         TestMempoolConfig(),
		StateSync:       TestStateSyncConfig(),
		FastSync:        TestFastSyncConfig(),
		Consensus:       TestConsensusConfig(),
		TxIndex:         TestTxIndexConfig(),
		Instrumentation: TestInstrumentationConfig(),
	}
}
func (cfg *Config) SetRoot(root string) *Config {
	cfg.BaseConfig.RootDir = root
	cfg.RPC.RootDir = root
	cfg.P2P.RootDir = root
	cfg.Mempool.RootDir = root
	cfg.Consensus.RootDir = root
	return cfg
}
func (cfg *Config) ValidateBasic() error {
	if err := cfg.BaseConfig.ValidateBasic(); err != nil {
		return err
	}
	if err := cfg.RPC.ValidateBasic(); err != nil {
		return fmt.Errorf("error in [rpc] section: %w", err)
	}
	if err := cfg.P2P.ValidateBasic(); err != nil {
		return fmt.Errorf("error in [p2p] section: %w", err)
	}
	if err := cfg.Mempool.ValidateBasic(); err != nil {
		return fmt.Errorf("error in [mempool] section: %w", err)
	}
	if err := cfg.StateSync.ValidateBasic(); err != nil {
		return fmt.Errorf("error in [statesync] section: %w", err)
	}
	if err := cfg.FastSync.ValidateBasic(); err != nil {
		return fmt.Errorf("error in [fastsync] section: %w", err)
	}
	if err := cfg.Consensus.ValidateBasic(); err != nil {
		return fmt.Errorf("error in [consensus] section: %w", err)
	}
	if err := cfg.Instrumentation.ValidateBasic(); err != nil {
		return fmt.Errorf("error in [instrumentation] section: %w", err)
	}
	return nil
}
type BaseConfig struct {  
	chainID string
	RootDir string `mapstructure:"home"`
	ProxyApp string `mapstructure:"proxy_app"`
	Moniker string `mapstructure:"moniker"`
	FastSyncMode bool `mapstructure:"fast_sync"`
	DBBackend string `mapstructure:"db_backend"`
	DBPath string `mapstructure:"db_dir"`
	LogLevel string `mapstructure:"log_level"`
	LogFormat string `mapstructure:"log_format"`
	Genesis string `mapstructure:"genesis_file"`
	PrivValidatorKey string `mapstructure:"priv_validator_key_file"`
	PrivValidatorState string `mapstructure:"priv_validator_state_file"`
	PrivValidatorListenAddr string `mapstructure:"priv_validator_laddr"`
	NodeKey string `mapstructure:"node_key_file"`
	ABCI string `mapstructure:"abci"`
	FilterPeers bool `mapstructure:"filter_peers"`  
	PrivKeyType string `mapstructure:"priv_key_type"`
}
func DefaultBaseConfig() BaseConfig {
	dbs := metadb.AvailableDBBackends()
	defaultDBBackend := DefaultDBBackend
	for _, b := range dbs {
		defaultDBBackend = string(b)
		if defaultDBBackend == DefaultDBBackend {
			break
		}
	}
	return BaseConfig{
		Genesis:            defaultGenesisJSONPath,
		PrivValidatorKey:   defaultPrivValKeyPath,
		PrivValidatorState: defaultPrivValStatePath,
		NodeKey:            defaultNodeKeyPath,
		Moniker:            defaultMoniker,
		ProxyApp:           "tcp://127.0.0.1:26658",
		ABCI:               "socket",
		LogLevel:           DefaultLogLevel,
		LogFormat:          LogFormatPlain,
		FastSyncMode:       true,
		FilterPeers:        false,
		DBBackend:          defaultDBBackend,
		DBPath:             "data",
		PrivKeyType:        privval.PrivKeyTypeEd25519,
	}
}