clean up CLI options

This commit is contained in:
Tuna 2018-09-28 16:15:33 +07:00
parent 0db859674a
commit 1c1624b13e
9 changed files with 135 additions and 138 deletions

View file

@ -32,7 +32,7 @@ import (
var (
walletCommand = cli.Command{
Name: "wallet",
Usage: "Manage Ethereum presale wallets",
Usage: "Manage Tomochain presale wallets",
ArgsUsage: "",
Category: "ACCOUNT COMMANDS",
Description: `
@ -45,7 +45,7 @@ passwordfile as argument containing the wallet password in plaintext.`,
{
Name: "import",
Usage: "Import Ethereum presale wallet",
Usage: "Import Tomochain presale wallet",
ArgsUsage: "<keyFile>",
Action: utils.MigrateFlags(importWallet),
Category: "ACCOUNT COMMANDS",

View file

@ -31,7 +31,7 @@ import (
)
const (
ipcAPIs = "admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 shh:1.0 txpool:1.0 web3:1.0"
ipcAPIs = "admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0"
httpAPIs = "eth:1.0 net:1.0 rpc:1.0 web3:1.0"
)
@ -43,7 +43,7 @@ func TestConsoleWelcome(t *testing.T) {
// Start a tomo console, make sure it's cleaned up and terminate the console
tomo := runTomo(t,
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
"--etherbase", coinbase, "--shh",
"--etherbase", coinbase,
"console")
// Gather all the infos the welcome message needs to contain
@ -81,11 +81,9 @@ func TestIPCAttachWelcome(t *testing.T) {
defer os.RemoveAll(ws)
ipc = filepath.Join(ws, "tomo.ipc")
}
// Note: we need --shh because testAttachWelcome checks for default
// list of ipc modules and shh is included there.
tomo := runTomo(t,
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
"--etherbase", coinbase, "--shh", "--ipcpath", ipc)
"--etherbase", coinbase, "--ipcpath", ipc)
time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open
testAttachWelcome(t, tomo, "ipc:"+ipc, ipcAPIs)

View file

@ -58,38 +58,38 @@ var (
utils.BootnodesV5Flag,
utils.DataDirFlag,
utils.KeyStoreDirFlag,
utils.NoUSBFlag,
utils.DashboardEnabledFlag,
utils.DashboardAddrFlag,
utils.DashboardPortFlag,
utils.DashboardRefreshFlag,
utils.EthashCacheDirFlag,
utils.EthashCachesInMemoryFlag,
utils.EthashCachesOnDiskFlag,
utils.EthashDatasetDirFlag,
utils.EthashDatasetsInMemoryFlag,
utils.EthashDatasetsOnDiskFlag,
utils.TxPoolNoLocalsFlag,
utils.TxPoolJournalFlag,
utils.TxPoolRejournalFlag,
utils.TxPoolPriceLimitFlag,
utils.TxPoolPriceBumpFlag,
utils.TxPoolAccountSlotsFlag,
utils.TxPoolGlobalSlotsFlag,
utils.TxPoolAccountQueueFlag,
utils.TxPoolGlobalQueueFlag,
utils.TxPoolLifetimeFlag,
//utils.NoUSBFlag,
//utils.DashboardEnabledFlag,
//utils.DashboardAddrFlag,
//utils.DashboardPortFlag,
//utils.DashboardRefreshFlag,
//utils.EthashCacheDirFlag,
//utils.EthashCachesInMemoryFlag,
//utils.EthashCachesOnDiskFlag,
//utils.EthashDatasetDirFlag,
//utils.EthashDatasetsInMemoryFlag,
//utils.EthashDatasetsOnDiskFlag,
//utils.TxPoolNoLocalsFlag,
//utils.TxPoolJournalFlag,
//utils.TxPoolRejournalFlag,
//utils.TxPoolPriceLimitFlag,
//utils.TxPoolPriceBumpFlag,
//utils.TxPoolAccountSlotsFlag,
//utils.TxPoolGlobalSlotsFlag,
//utils.TxPoolAccountQueueFlag,
//utils.TxPoolGlobalQueueFlag,
//utils.TxPoolLifetimeFlag,
utils.FastSyncFlag,
utils.LightModeFlag,
utils.SyncModeFlag,
utils.GCModeFlag,
utils.LightServFlag,
utils.LightPeersFlag,
utils.LightKDFFlag,
utils.CacheFlag,
utils.CacheDatabaseFlag,
utils.CacheGCFlag,
utils.TrieCacheGenFlag,
//utils.LightServFlag,
//utils.LightPeersFlag,
//utils.LightKDFFlag,
//utils.CacheFlag,
//utils.CacheDatabaseFlag,
//utils.CacheGCFlag,
//utils.TrieCacheGenFlag,
utils.ListenPortFlag,
utils.MaxPeersFlag,
utils.MaxPendingPeersFlag,
@ -100,25 +100,25 @@ var (
utils.TargetGasLimitFlag,
utils.NATFlag,
utils.NoDiscoverFlag,
utils.DiscoveryV5Flag,
utils.NetrestrictFlag,
//utils.DiscoveryV5Flag,
//utils.NetrestrictFlag,
utils.NodeKeyFileFlag,
utils.NodeKeyHexFlag,
utils.DeveloperFlag,
utils.DeveloperPeriodFlag,
utils.TestnetFlag,
utils.RinkebyFlag,
utils.VMEnableDebugFlag,
//utils.DeveloperFlag,
//utils.DeveloperPeriodFlag,
//utils.TestnetFlag,
//utils.RinkebyFlag,
//utils.VMEnableDebugFlag,
utils.NetworkIdFlag,
utils.RPCCORSDomainFlag,
utils.RPCVirtualHostsFlag,
utils.EthStatsURLFlag,
utils.MetricsEnabledFlag,
utils.FakePoWFlag,
utils.NoCompactionFlag,
utils.GpoBlocksFlag,
utils.GpoPercentileFlag,
utils.ExtraDataFlag,
//utils.FakePoWFlag,
//utils.NoCompactionFlag,
//utils.GpoBlocksFlag,
//utils.GpoPercentileFlag,
//utils.ExtraDataFlag,
configFileFlag,
}
@ -153,13 +153,8 @@ func init() {
initCommand,
importCommand,
exportCommand,
importPreimagesCommand,
exportPreimagesCommand,
copydbCommand,
removedbCommand,
dumpCommand,
// See monitorcmd.go:
monitorCommand,
// See accountcmd.go:
accountCommand,
walletCommand,
@ -168,11 +163,7 @@ func init() {
attachCommand,
javascriptCommand,
// See misccmd.go:
makecacheCommand,
makedagCommand,
versionCommand,
bugCommand,
licenseCommand,
// See config.go
dumpConfigCommand,
}
@ -182,7 +173,7 @@ func init() {
app.Flags = append(app.Flags, rpcFlags...)
app.Flags = append(app.Flags, consoleFlags...)
app.Flags = append(app.Flags, debug.Flags...)
app.Flags = append(app.Flags, whisperFlags...)
//app.Flags = append(app.Flags, whisperFlags...)
app.Before = func(ctx *cli.Context) error {
runtime.GOMAXPROCS(runtime.NumCPU())

View file

@ -65,41 +65,41 @@ type flagGroup struct {
// AppHelpFlagGroups is the application flags, grouped by functionality.
var AppHelpFlagGroups = []flagGroup{
{
Name: "ETHEREUM",
Name: "TOMOCHAIN",
Flags: []cli.Flag{
configFileFlag,
utils.DataDirFlag,
utils.KeyStoreDirFlag,
utils.NoUSBFlag,
//utils.NoUSBFlag,
utils.NetworkIdFlag,
utils.TestnetFlag,
utils.RinkebyFlag,
//utils.TestnetFlag,
//utils.RinkebyFlag,
utils.SyncModeFlag,
utils.GCModeFlag,
utils.EthStatsURLFlag,
utils.IdentityFlag,
utils.LightServFlag,
utils.LightPeersFlag,
utils.LightKDFFlag,
},
},
{Name: "DEVELOPER CHAIN",
Flags: []cli.Flag{
utils.DeveloperFlag,
utils.DeveloperPeriodFlag,
},
},
{
Name: "ETHASH",
Flags: []cli.Flag{
utils.EthashCacheDirFlag,
utils.EthashCachesInMemoryFlag,
utils.EthashCachesOnDiskFlag,
utils.EthashDatasetDirFlag,
utils.EthashDatasetsInMemoryFlag,
utils.EthashDatasetsOnDiskFlag,
//utils.LightServFlag,
//utils.LightPeersFlag,
//utils.LightKDFFlag,
},
},
//{Name: "DEVELOPER CHAIN",
// Flags: []cli.Flag{
// utils.DeveloperFlag,
// utils.DeveloperPeriodFlag,
// },
//},
//{
// Name: "ETHASH",
// Flags: []cli.Flag{
// utils.EthashCacheDirFlag,
// utils.EthashCachesInMemoryFlag,
// utils.EthashCachesOnDiskFlag,
// utils.EthashDatasetDirFlag,
// utils.EthashDatasetsInMemoryFlag,
// utils.EthashDatasetsOnDiskFlag,
// },
//},
//{
// Name: "DASHBOARD",
// Flags: []cli.Flag{
@ -110,30 +110,30 @@ var AppHelpFlagGroups = []flagGroup{
// utils.DashboardAssetsFlag,
// },
//},
{
Name: "TRANSACTION POOL",
Flags: []cli.Flag{
utils.TxPoolNoLocalsFlag,
utils.TxPoolJournalFlag,
utils.TxPoolRejournalFlag,
utils.TxPoolPriceLimitFlag,
utils.TxPoolPriceBumpFlag,
utils.TxPoolAccountSlotsFlag,
utils.TxPoolGlobalSlotsFlag,
utils.TxPoolAccountQueueFlag,
utils.TxPoolGlobalQueueFlag,
utils.TxPoolLifetimeFlag,
},
},
{
Name: "PERFORMANCE TUNING",
Flags: []cli.Flag{
utils.CacheFlag,
utils.CacheDatabaseFlag,
utils.CacheGCFlag,
utils.TrieCacheGenFlag,
},
},
//{
// Name: "TRANSACTION POOL",
// Flags: []cli.Flag{
// utils.TxPoolNoLocalsFlag,
// utils.TxPoolJournalFlag,
// utils.TxPoolRejournalFlag,
// utils.TxPoolPriceLimitFlag,
// utils.TxPoolPriceBumpFlag,
// utils.TxPoolAccountSlotsFlag,
// utils.TxPoolGlobalSlotsFlag,
// utils.TxPoolAccountQueueFlag,
// utils.TxPoolGlobalQueueFlag,
// utils.TxPoolLifetimeFlag,
// },
//},
//{
// Name: "PERFORMANCE TUNING",
// Flags: []cli.Flag{
// utils.CacheFlag,
// utils.CacheDatabaseFlag,
// utils.CacheGCFlag,
// utils.TrieCacheGenFlag,
// },
//},
{
Name: "ACCOUNT",
Flags: []cli.Flag{
@ -173,14 +173,14 @@ var AppHelpFlagGroups = []flagGroup{
utils.MaxPendingPeersFlag,
utils.NATFlag,
utils.NoDiscoverFlag,
utils.DiscoveryV5Flag,
utils.NetrestrictFlag,
//utils.DiscoveryV5Flag,
//utils.NetrestrictFlag,
utils.NodeKeyFileFlag,
utils.NodeKeyHexFlag,
},
},
{
Name: "MINER",
Name: "STAKER",
Flags: []cli.Flag{
utils.StakingEnabledFlag,
utils.StakerThreadsFlag,
@ -190,31 +190,31 @@ var AppHelpFlagGroups = []flagGroup{
utils.ExtraDataFlag,
},
},
{
Name: "GAS PRICE ORACLE",
Flags: []cli.Flag{
utils.GpoBlocksFlag,
utils.GpoPercentileFlag,
},
},
{
Name: "VIRTUAL MACHINE",
Flags: []cli.Flag{
utils.VMEnableDebugFlag,
},
},
//{
// Name: "GAS PRICE ORACLE",
// Flags: []cli.Flag{
// utils.GpoBlocksFlag,
// utils.GpoPercentileFlag,
// },
//},
//{
// Name: "VIRTUAL MACHINE",
// Flags: []cli.Flag{
// utils.VMEnableDebugFlag,
// },
//},
{
Name: "LOGGING AND DEBUGGING",
Flags: append([]cli.Flag{
utils.MetricsEnabledFlag,
utils.FakePoWFlag,
utils.NoCompactionFlag,
//utils.FakePoWFlag,
//utils.NoCompactionFlag,
}, debug.Flags...),
},
{
Name: "WHISPER (EXPERIMENTAL)",
Flags: whisperFlags,
},
//{
// Name: "WHISPER (EXPERIMENTAL)",
// Flags: whisperFlags,
//},
{
Name: "DEPRECATED",
Flags: []cli.Flag{

View file

@ -128,7 +128,7 @@ var (
}
NetworkIdFlag = cli.Uint64Flag{
Name: "networkid",
Usage: "Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby)",
Usage: "Network identifier (integer, 89=Tomochain)",
Value: eth.DefaultConfig.NetworkId,
}
TestnetFlag = cli.BoolFlag{

View file

@ -43,7 +43,7 @@ var DefaultConfig = Config{
DatasetsInMem: 1,
DatasetsOnDisk: 2,
},
NetworkId: 1,
NetworkId: 89,
LightPeers: 100,
DatabaseCache: 768,
TrieCache: 256,

View file

@ -63,8 +63,8 @@ func testStatusMsgErrors(t *testing.T, protocol int) {
wantError: errResp(ErrProtocolVersionMismatch, "10 (!= %d)", protocol),
},
{
code: StatusMsg, data: statusData{uint32(protocol), 999, td, head.Hash(), genesis.Hash()},
wantError: errResp(ErrNetworkIdMismatch, "999 (!= 1)"),
code: StatusMsg, data: statusData{uint32(protocol), 89, td, head.Hash(), genesis.Hash()},
wantError: errResp(ErrNetworkIdMismatch, "89 (!= 1)"),
},
{
code: StatusMsg, data: statusData{uint32(protocol), DefaultConfig.NetworkId, td, head.Hash(), common.Hash{3}},
@ -85,7 +85,7 @@ func testStatusMsgErrors(t *testing.T, protocol int) {
} else if err.Error() != test.wantError.Error() {
t.Errorf("test %d: wrong error: got %q, want %q", i, err, test.wantError)
}
case <-time.After(2 * time.Second):
case <-time.After(5 * time.Second):
t.Errorf("protocol did not shut down within 2 seconds")
}
p.close()

View file

@ -87,9 +87,17 @@ var (
// Flags holds all command-line flags required for debugging.
var Flags = []cli.Flag{
VerbosityFlag, vmoduleFlag, backtraceAtFlag, debugFlag,
pprofFlag, pprofAddrFlag, pprofPortFlag,
memprofilerateFlag, blockprofilerateFlag, cpuprofileFlag, traceFlag,
VerbosityFlag,
//vmoduleFlag,
//backtraceAtFlag,
//debugFlag,
//pprofFlag,
//pprofAddrFlag,
//pprofPortFlag,
//memprofilerateFlag,
//blockprofilerateFlag,
//cpuprofileFlag,
//traceFlag,
}
var Glogger *log.GlogHandler

View file

@ -55,11 +55,11 @@ func DefaultDataDir() string {
home := homeDir()
if home != "" {
if runtime.GOOS == "darwin" {
return filepath.Join(home, "Library", "Ethereum")
return filepath.Join(home, "Library", "Tomochain")
} else if runtime.GOOS == "windows" {
return filepath.Join(home, "AppData", "Roaming", "Ethereum")
return filepath.Join(home, "AppData", "Roaming", "Tomochain")
} else {
return filepath.Join(home, ".ethereum")
return filepath.Join(home, ".tomo")
}
}
// As we cannot guess a stable location, return empty and handle later