From 40f3071364cde56aba5bb7865a79c6c0ac930678 Mon Sep 17 00:00:00 2001 From: LexLuthr <88259624+LexLuthr@users.noreply.github.com> Date: Wed, 6 Mar 2024 13:41:37 +0400 Subject: [PATCH] fix: curio: base config by default (#11676) * base config by default * remove global --layers flag --- cmd/lotus-provider/config.go | 9 ++-- cmd/lotus-provider/config_new.go | 2 +- cmd/lotus-provider/deps/deps.go | 2 +- cmd/lotus-provider/main.go | 6 --- cmd/lotus-provider/pipeline.go | 4 ++ cmd/lotus-provider/proving.go | 5 +- cmd/lotus-provider/run.go | 8 +++ documentation/en/cli-lotus-provider.md | 75 +++++++++++++------------- 8 files changed, 61 insertions(+), 50 deletions(-) diff --git a/cmd/lotus-provider/config.go b/cmd/lotus-provider/config.go index 670e05b9d..1f155f543 100644 --- a/cmd/lotus-provider/config.go +++ b/cmd/lotus-provider/config.go @@ -22,7 +22,7 @@ import ( var configCmd = &cli.Command{ Name: "config", - Usage: "Manage node config by layers. The layer 'base' will always be applied. ", + Usage: "Manage node config by layers. The layer 'base' will always be applied at Curio start-up.", Subcommands: []*cli.Command{ configDefaultCmd, configSetCmd, @@ -168,7 +168,7 @@ func getConfig(db *harmonydb.DB, layer string) (string, error) { var configListCmd = &cli.Command{ Name: "list", Aliases: []string{"ls"}, - Usage: "List config layers you can get.", + Usage: "List config layers present in the DB.", Flags: []cli.Flag{}, Action: func(cctx *cli.Context) error { db, err := deps.MakeDB(cctx) @@ -221,8 +221,7 @@ var configViewCmd = &cli.Command{ Flags: []cli.Flag{ &cli.StringSliceFlag{ Name: "layers", - Usage: "comma or space separated list of layers to be interpreted", - Value: cli.NewStringSlice("base"), + Usage: "comma or space separated list of layers to be interpreted (base is always applied)", Required: true, }, }, @@ -261,7 +260,7 @@ var configEditCmd = &cli.Command{ DefaultText: "", }, &cli.BoolFlag{ - Name: "allow-owerwrite", + Name: "allow-overwrite", Usage: "allow overwrite of existing layer if source is a different layer", }, &cli.BoolFlag{ diff --git a/cmd/lotus-provider/config_new.go b/cmd/lotus-provider/config_new.go index 38949959a..e9d8382ac 100644 --- a/cmd/lotus-provider/config_new.go +++ b/cmd/lotus-provider/config_new.go @@ -25,7 +25,7 @@ import ( var configNewCmd = &cli.Command{ Name: "new-cluster", - Usage: "Create new coniguration for a new cluster", + Usage: "Create new configuration for a new cluster", ArgsUsage: "[SP actor address...]", Flags: []cli.Flag{ &cli.StringFlag{ diff --git a/cmd/lotus-provider/deps/deps.go b/cmd/lotus-provider/deps/deps.go index d38110dd1..e03e7dd24 100644 --- a/cmd/lotus-provider/deps/deps.go +++ b/cmd/lotus-provider/deps/deps.go @@ -289,7 +289,7 @@ func LoadConfigWithUpgrades(text string, lp *config.LotusProviderConfig) (toml.M func GetConfig(cctx *cli.Context, db *harmonydb.DB) (*config.LotusProviderConfig, error) { lp := config.DefaultLotusProvider() have := []string{} - layers := cctx.StringSlice("layers") + layers := append([]string{"base"}, cctx.StringSlice("layers")...) // Always stack on top of "base" layer for _, layer := range layers { text := "" err := db.QueryRow(cctx.Context, `SELECT config FROM harmony_config WHERE title=$1`, layer).Scan(&text) diff --git a/cmd/lotus-provider/main.go b/cmd/lotus-provider/main.go index bfb17f200..b4342d49a 100644 --- a/cmd/lotus-provider/main.go +++ b/cmd/lotus-provider/main.go @@ -124,12 +124,6 @@ func main() { Hidden: true, Value: "5433", }, - &cli.StringSliceFlag{ - Name: "layers", - EnvVars: []string{"CURIO_LAYERS"}, - Usage: "list of layers to be interpreted (atop defaults). Default: base", - Value: cli.NewStringSlice("base"), - }, &cli.StringFlag{ Name: deps.FlagRepoPath, EnvVars: []string{"LOTUS_REPO_PATH"}, diff --git a/cmd/lotus-provider/pipeline.go b/cmd/lotus-provider/pipeline.go index 45a1c3a17..74c49b16a 100644 --- a/cmd/lotus-provider/pipeline.go +++ b/cmd/lotus-provider/pipeline.go @@ -52,6 +52,10 @@ var sealStartCmd = &cli.Command{ Usage: "Use synthetic PoRep", Value: false, // todo implement synthetic }, + &cli.StringSliceFlag{ + Name: "layers", + Usage: "list of layers to be interpreted (atop defaults). Default: base", + }, }, Action: func(cctx *cli.Context) error { if !cctx.Bool("now") { diff --git a/cmd/lotus-provider/proving.go b/cmd/lotus-provider/proving.go index cfe7e921a..c003c907f 100644 --- a/cmd/lotus-provider/proving.go +++ b/cmd/lotus-provider/proving.go @@ -54,6 +54,10 @@ var wdPostTaskCmd = &cli.Command{ Usage: "deadline to compute WindowPoSt for ", Value: 0, }, + &cli.StringSliceFlag{ + Name: "layers", + Usage: "list of layers to be interpreted (atop defaults). Default: base", + }, }, Action: func(cctx *cli.Context) error { ctx := context.Background() @@ -140,7 +144,6 @@ It will not send any messages to the chain. Since it can compute any deadline, o &cli.StringSliceFlag{ Name: "layers", Usage: "list of layers to be interpreted (atop defaults). Default: base", - Value: cli.NewStringSlice("base"), }, &cli.StringFlag{ Name: "storage-json", diff --git a/cmd/lotus-provider/run.go b/cmd/lotus-provider/run.go index 5135f8a0b..018f746f0 100644 --- a/cmd/lotus-provider/run.go +++ b/cmd/lotus-provider/run.go @@ -60,6 +60,10 @@ var runCmd = &cli.Command{ Usage: "path to journal files", Value: "~/.lotus-provider/", }, + &cli.StringSliceFlag{ + Name: "layers", + Usage: "list of layers to be interpreted (atop defaults). Default: base", + }, }, Action: func(cctx *cli.Context) (err error) { defer func() { @@ -153,6 +157,10 @@ var webCmd = &cli.Command{ Name: "nosync", Usage: "don't check full-node sync status", }, + &cli.StringSliceFlag{ + Name: "layers", + Usage: "list of layers to be interpreted (atop defaults). Default: base", + }, }, Action: func(cctx *cli.Context) error { db, err := deps.MakeDB(cctx) diff --git a/documentation/en/cli-lotus-provider.md b/documentation/en/cli-lotus-provider.md index e424bce92..984d1a2d5 100644 --- a/documentation/en/cli-lotus-provider.md +++ b/documentation/en/cli-lotus-provider.md @@ -13,7 +13,7 @@ COMMANDS: cli Execute cli commands run Start a lotus provider process stop Stop a running lotus provider - config Manage node config by layers. The layer 'base' will always be applied. + config Manage node config by layers. The layer 'base' will always be applied at Curio start-up. test Utility functions for testing web Start lotus provider web interface seal Manage the sealing pipeline @@ -26,16 +26,15 @@ COMMANDS: fetch-params Fetch proving parameters GLOBAL OPTIONS: - --color use color in display output (default: depends on output being a TTY) - --db-host value Command separated list of hostnames for yugabyte cluster (default: "yugabyte") [$LOTUS_DB_HOST] - --db-name value (default: "yugabyte") [$LOTUS_DB_NAME, $LOTUS_HARMONYDB_HOSTS] - --db-user value (default: "yugabyte") [$LOTUS_DB_USER, $LOTUS_HARMONYDB_USERNAME] - --db-password value (default: "yugabyte") [$LOTUS_DB_PASSWORD, $LOTUS_HARMONYDB_PASSWORD] - --layers value [ --layers value ] list of layers to be interpreted (atop defaults). Default: base (default: "base") [$CURIO_LAYERS] - --repo-path value (default: "~/.lotusprovider") [$LOTUS_REPO_PATH] - --vv enables very verbose mode, useful for debugging the CLI (default: false) - --help, -h show help - --version, -v print the version + --color use color in display output (default: depends on output being a TTY) + --db-host value Command separated list of hostnames for yugabyte cluster (default: "yugabyte") [$LOTUS_DB_HOST] + --db-name value (default: "yugabyte") [$LOTUS_DB_NAME, $LOTUS_HARMONYDB_HOSTS] + --db-user value (default: "yugabyte") [$LOTUS_DB_USER, $LOTUS_HARMONYDB_USERNAME] + --db-password value (default: "yugabyte") [$LOTUS_DB_PASSWORD, $LOTUS_HARMONYDB_PASSWORD] + --repo-path value (default: "~/.lotusprovider") [$LOTUS_REPO_PATH] + --vv enables very verbose mode, useful for debugging the CLI (default: false) + --help, -h show help + --version, -v print the version ``` ## lotus-provider cli @@ -68,12 +67,13 @@ USAGE: lotus-provider run [command options] [arguments...] OPTIONS: - --listen value host address and port the worker api will listen on (default: "0.0.0.0:12300") [$LOTUS_WORKER_LISTEN] - --nosync don't check full-node sync status (default: false) - --manage-fdlimit manage open file limit (default: true) - --storage-json value path to json file containing storage config (default: "~/.lotus-provider/storage.json") - --journal value path to journal files (default: "~/.lotus-provider/") - --help, -h show help + --listen value host address and port the worker api will listen on (default: "0.0.0.0:12300") [$LOTUS_WORKER_LISTEN] + --nosync don't check full-node sync status (default: false) + --manage-fdlimit manage open file limit (default: true) + --storage-json value path to json file containing storage config (default: "~/.lotus-provider/storage.json") + --journal value path to journal files (default: "~/.lotus-provider/") + --layers value [ --layers value ] list of layers to be interpreted (atop defaults). Default: base + --help, -h show help ``` ## lotus-provider stop @@ -91,7 +91,7 @@ OPTIONS: ## lotus-provider config ``` NAME: - lotus-provider config - Manage node config by layers. The layer 'base' will always be applied. + lotus-provider config - Manage node config by layers. The layer 'base' will always be applied at Curio start-up. USAGE: lotus-provider config command [command options] [arguments...] @@ -100,12 +100,12 @@ COMMANDS: default, defaults Print default node config set, add, update, create Set a config layer or the base by providing a filename or stdin. get, cat, show Get a config layer by name. You may want to pipe the output to a file, or use 'less' - list, ls List config layers you can get. + list, ls List config layers present in the DB. interpret, view, stacked, stack Interpret stacked config layers by this version of lotus-provider, with system-generated comments. remove, rm, del, delete Remove a named config layer. edit edit a config layer from-miner Express a database config (for lotus-provider) from an existing miner. - new-cluster Create new coniguration for a new cluster + new-cluster Create new configuration for a new cluster help, h Shows a list of commands or help for one command OPTIONS: @@ -153,7 +153,7 @@ OPTIONS: ### lotus-provider config list ``` NAME: - lotus-provider config list - List config layers you can get. + lotus-provider config list - List config layers present in the DB. USAGE: lotus-provider config list [command options] [arguments...] @@ -171,7 +171,7 @@ USAGE: lotus-provider config interpret [command options] a list of layers to be interpreted as the final config OPTIONS: - --layers value [ --layers value ] comma or space separated list of layers to be interpreted (default: "base") + --layers value [ --layers value ] comma or space separated list of layers to be interpreted (base is always applied) --help, -h show help ``` @@ -198,7 +198,7 @@ USAGE: OPTIONS: --editor value editor to use (default: "vim") [$EDITOR] --source value source config layer (default: ) - --allow-owerwrite allow overwrite of existing layer if source is a different layer (default: false) + --allow-overwrite allow overwrite of existing layer if source is a different layer (default: false) --no-source-diff save the whole config into the layer, not just the diff (default: false) --no-interpret-source do not interpret source layer (default: true if --source is set) --help, -h show help @@ -225,7 +225,7 @@ OPTIONS: ### lotus-provider config new-cluster ``` NAME: - lotus-provider config new-cluster - Create new coniguration for a new cluster + lotus-provider config new-cluster - Create new configuration for a new cluster USAGE: lotus-provider config new-cluster [command options] [SP actor address...] @@ -281,7 +281,7 @@ DESCRIPTION: OPTIONS: --deadline value deadline to compute WindowPoSt for (default: 0) - --layers value [ --layers value ] list of layers to be interpreted (atop defaults). Default: base (default: "base") + --layers value [ --layers value ] list of layers to be interpreted (atop defaults). Default: base --storage-json value path to json file containing storage config (default: "~/.lotus-provider/storage.json") --partition value partition to compute WindowPoSt for (default: 0) --help, -h show help @@ -296,8 +296,9 @@ USAGE: lotus-provider test window-post task [command options] [arguments...] OPTIONS: - --deadline value deadline to compute WindowPoSt for (default: 0) - --help, -h show help + --deadline value deadline to compute WindowPoSt for (default: 0) + --layers value [ --layers value ] list of layers to be interpreted (atop defaults). Default: base + --help, -h show help ``` ## lotus-provider web @@ -313,9 +314,10 @@ DESCRIPTION: This creates the 'web' layer if it does not exist, then calls run with that layer. OPTIONS: - --listen value Address to listen on (default: "127.0.0.1:4701") - --nosync don't check full-node sync status (default: false) - --help, -h show help + --listen value Address to listen on (default: "127.0.0.1:4701") + --nosync don't check full-node sync status (default: false) + --layers value [ --layers value ] list of layers to be interpreted (atop defaults). Default: base + --help, -h show help ``` ## lotus-provider seal @@ -343,12 +345,13 @@ USAGE: lotus-provider seal start [command options] [arguments...] OPTIONS: - --actor value Specify actor address to start sealing sectors for - --now Start sealing sectors for all actors now (not on schedule) (default: false) - --cc Start sealing new CC sectors (default: false) - --count value Number of sectors to start (default: 1) - --synthetic Use synthetic PoRep (default: false) - --help, -h show help + --actor value Specify actor address to start sealing sectors for + --now Start sealing sectors for all actors now (not on schedule) (default: false) + --cc Start sealing new CC sectors (default: false) + --count value Number of sectors to start (default: 1) + --synthetic Use synthetic PoRep (default: false) + --layers value [ --layers value ] list of layers to be interpreted (atop defaults). Default: base + --help, -h show help ``` ## lotus-provider version