From cc4f72b16596c41801963d7048064061bcbe3708 Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Wed, 1 May 2024 12:26:39 +0800 Subject: [PATCH] revise file structure in cmd --- cmd/{kava/cmd => 0gchaind}/app.go | 2 +- cmd/{kava/cmd => 0gchaind}/assert-invariants.go | 2 +- cmd/{kava/cmd => 0gchaind}/genaccounts.go | 2 +- cmd/{kava/cmd => 0gchaind}/keys.go | 0 cmd/{kava => 0gchaind}/main.go | 10 ++++++---- cmd/{kava/cmd => 0gchaind}/query.go | 2 +- cmd/{kava/cmd => 0gchaind}/root.go | 4 ++-- cmd/{kava/cmd => 0gchaind}/shard.go | 0 cmd/{kava/cmd => 0gchaind}/status.go | 2 +- cmd/{kava/cmd => 0gchaind}/tx.go | 2 +- cmd/{kava => }/opendb/metrics.go | 0 cmd/{kava => }/opendb/opendb.go | 0 cmd/{kava => }/opendb/opendb_rocksdb.go | 0 cmd/{kava => }/opendb/opendb_rocksdb_test.go | 0 cmd/{kava => }/opendb/props_loader.go | 0 cmd/{kava => }/opendb/props_loader_test.go | 0 cmd/{kava => }/opendb/stat_parser.go | 0 cmd/{kava => }/opendb/stat_parser_test.go | 0 cmd/{kava => }/opendb/stats_loader.go | 0 cmd/{kava => }/opendb/stats_loader_test.go | 0 20 files changed, 14 insertions(+), 12 deletions(-) rename cmd/{kava/cmd => 0gchaind}/app.go (99%) rename cmd/{kava/cmd => 0gchaind}/assert-invariants.go (99%) rename cmd/{kava/cmd => 0gchaind}/genaccounts.go (99%) rename cmd/{kava/cmd => 0gchaind}/keys.go (100%) rename cmd/{kava => 0gchaind}/main.go (52%) rename cmd/{kava/cmd => 0gchaind}/query.go (98%) rename cmd/{kava/cmd => 0gchaind}/root.go (98%) rename cmd/{kava/cmd => 0gchaind}/shard.go (100%) rename cmd/{kava/cmd => 0gchaind}/status.go (99%) rename cmd/{kava/cmd => 0gchaind}/tx.go (98%) rename cmd/{kava => }/opendb/metrics.go (100%) rename cmd/{kava => }/opendb/opendb.go (100%) rename cmd/{kava => }/opendb/opendb_rocksdb.go (100%) rename cmd/{kava => }/opendb/opendb_rocksdb_test.go (100%) rename cmd/{kava => }/opendb/props_loader.go (100%) rename cmd/{kava => }/opendb/props_loader_test.go (100%) rename cmd/{kava => }/opendb/stat_parser.go (100%) rename cmd/{kava => }/opendb/stat_parser_test.go (100%) rename cmd/{kava => }/opendb/stats_loader.go (100%) rename cmd/{kava => }/opendb/stats_loader_test.go (100%) diff --git a/cmd/kava/cmd/app.go b/cmd/0gchaind/app.go similarity index 99% rename from cmd/kava/cmd/app.go rename to cmd/0gchaind/app.go index d2e3956d..d5862f58 100644 --- a/cmd/kava/cmd/app.go +++ b/cmd/0gchaind/app.go @@ -1,4 +1,4 @@ -package cmd +package main import ( "errors" diff --git a/cmd/kava/cmd/assert-invariants.go b/cmd/0gchaind/assert-invariants.go similarity index 99% rename from cmd/kava/cmd/assert-invariants.go rename to cmd/0gchaind/assert-invariants.go index fbdeb825..6a83442e 100644 --- a/cmd/kava/cmd/assert-invariants.go +++ b/cmd/0gchaind/assert-invariants.go @@ -1,4 +1,4 @@ -package cmd +package main import ( "encoding/json" diff --git a/cmd/kava/cmd/genaccounts.go b/cmd/0gchaind/genaccounts.go similarity index 99% rename from cmd/kava/cmd/genaccounts.go rename to cmd/0gchaind/genaccounts.go index 5a5d157f..ef5e920e 100644 --- a/cmd/kava/cmd/genaccounts.go +++ b/cmd/0gchaind/genaccounts.go @@ -1,5 +1,5 @@ // Sourced from https://github.com/evmos/ethermint/blob/main/cmd/ethermintd/genaccounts.go -package cmd +package main import ( "bufio" diff --git a/cmd/kava/cmd/keys.go b/cmd/0gchaind/keys.go similarity index 100% rename from cmd/kava/cmd/keys.go rename to cmd/0gchaind/keys.go diff --git a/cmd/kava/main.go b/cmd/0gchaind/main.go similarity index 52% rename from cmd/kava/main.go rename to cmd/0gchaind/main.go index f15b33ec..5a1c4cfe 100644 --- a/cmd/kava/main.go +++ b/cmd/0gchaind/main.go @@ -6,14 +6,16 @@ import ( "github.com/cosmos/cosmos-sdk/server" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" - "github.com/0glabs/0g-chain/app" - "github.com/0glabs/0g-chain/cmd/kava/cmd" + "github.com/0glabs/0g-chain/chaincfg" ) func main() { - rootCmd := cmd.NewRootCmd() + chaincfg.SetSDKConfig().Seal() + chaincfg.RegisterDenoms() - if err := svrcmd.Execute(rootCmd, cmd.EnvPrefix, app.DefaultNodeHome); err != nil { + rootCmd := NewRootCmd() + + if err := svrcmd.Execute(rootCmd, chaincfg.EnvPrefix, chaincfg.DefaultNodeHome); err != nil { switch e := err.(type) { case server.ErrorCode: os.Exit(e.Code) diff --git a/cmd/kava/cmd/query.go b/cmd/0gchaind/query.go similarity index 98% rename from cmd/kava/cmd/query.go rename to cmd/0gchaind/query.go index a83e751d..e8021e99 100644 --- a/cmd/kava/cmd/query.go +++ b/cmd/0gchaind/query.go @@ -1,4 +1,4 @@ -package cmd +package main import ( "github.com/cosmos/cosmos-sdk/client" diff --git a/cmd/kava/cmd/root.go b/cmd/0gchaind/root.go similarity index 98% rename from cmd/kava/cmd/root.go rename to cmd/0gchaind/root.go index 2653383e..b18ed53e 100644 --- a/cmd/kava/cmd/root.go +++ b/cmd/0gchaind/root.go @@ -1,4 +1,4 @@ -package cmd +package main import ( "fmt" @@ -25,7 +25,7 @@ import ( "github.com/0glabs/0g-chain/app" "github.com/0glabs/0g-chain/app/params" - "github.com/0glabs/0g-chain/cmd/kava/opendb" + "github.com/0glabs/0g-chain/cmd/opendb" ) // EnvPrefix is the prefix environment variables must have to configure the app. diff --git a/cmd/kava/cmd/shard.go b/cmd/0gchaind/shard.go similarity index 100% rename from cmd/kava/cmd/shard.go rename to cmd/0gchaind/shard.go diff --git a/cmd/kava/cmd/status.go b/cmd/0gchaind/status.go similarity index 99% rename from cmd/kava/cmd/status.go rename to cmd/0gchaind/status.go index bc5165a0..8c15dc0f 100644 --- a/cmd/kava/cmd/status.go +++ b/cmd/0gchaind/status.go @@ -1,4 +1,4 @@ -package cmd +package main import ( "context" diff --git a/cmd/kava/cmd/tx.go b/cmd/0gchaind/tx.go similarity index 98% rename from cmd/kava/cmd/tx.go rename to cmd/0gchaind/tx.go index 2d6b4875..167e4b01 100644 --- a/cmd/kava/cmd/tx.go +++ b/cmd/0gchaind/tx.go @@ -1,4 +1,4 @@ -package cmd +package main import ( "github.com/cosmos/cosmos-sdk/client" diff --git a/cmd/kava/opendb/metrics.go b/cmd/opendb/metrics.go similarity index 100% rename from cmd/kava/opendb/metrics.go rename to cmd/opendb/metrics.go diff --git a/cmd/kava/opendb/opendb.go b/cmd/opendb/opendb.go similarity index 100% rename from cmd/kava/opendb/opendb.go rename to cmd/opendb/opendb.go diff --git a/cmd/kava/opendb/opendb_rocksdb.go b/cmd/opendb/opendb_rocksdb.go similarity index 100% rename from cmd/kava/opendb/opendb_rocksdb.go rename to cmd/opendb/opendb_rocksdb.go diff --git a/cmd/kava/opendb/opendb_rocksdb_test.go b/cmd/opendb/opendb_rocksdb_test.go similarity index 100% rename from cmd/kava/opendb/opendb_rocksdb_test.go rename to cmd/opendb/opendb_rocksdb_test.go diff --git a/cmd/kava/opendb/props_loader.go b/cmd/opendb/props_loader.go similarity index 100% rename from cmd/kava/opendb/props_loader.go rename to cmd/opendb/props_loader.go diff --git a/cmd/kava/opendb/props_loader_test.go b/cmd/opendb/props_loader_test.go similarity index 100% rename from cmd/kava/opendb/props_loader_test.go rename to cmd/opendb/props_loader_test.go diff --git a/cmd/kava/opendb/stat_parser.go b/cmd/opendb/stat_parser.go similarity index 100% rename from cmd/kava/opendb/stat_parser.go rename to cmd/opendb/stat_parser.go diff --git a/cmd/kava/opendb/stat_parser_test.go b/cmd/opendb/stat_parser_test.go similarity index 100% rename from cmd/kava/opendb/stat_parser_test.go rename to cmd/opendb/stat_parser_test.go diff --git a/cmd/kava/opendb/stats_loader.go b/cmd/opendb/stats_loader.go similarity index 100% rename from cmd/kava/opendb/stats_loader.go rename to cmd/opendb/stats_loader.go diff --git a/cmd/kava/opendb/stats_loader_test.go b/cmd/opendb/stats_loader_test.go similarity index 100% rename from cmd/kava/opendb/stats_loader_test.go rename to cmd/opendb/stats_loader_test.go