2019-12-09 15:09:23 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2023-05-16 11:25:57 +00:00
|
|
|
"context"
|
2023-02-15 16:09:24 +00:00
|
|
|
"fmt"
|
2019-12-09 15:09:23 +00:00
|
|
|
"os"
|
2023-05-16 11:25:57 +00:00
|
|
|
"os/signal"
|
2019-12-09 15:09:23 +00:00
|
|
|
|
2020-01-08 19:10:57 +00:00
|
|
|
logging "github.com/ipfs/go-log/v2"
|
2020-06-02 18:12:53 +00:00
|
|
|
"github.com/urfave/cli/v2"
|
2019-12-09 15:09:23 +00:00
|
|
|
|
|
|
|
"github.com/filecoin-project/lotus/build"
|
|
|
|
)
|
|
|
|
|
|
|
|
var log = logging.Logger("lotus-shed")
|
|
|
|
|
|
|
|
func main() {
|
2022-11-16 23:19:59 +00:00
|
|
|
_ = logging.SetLogLevel("*", "INFO")
|
|
|
|
_ = logging.SetLogLevelRegex("badger*", "ERROR")
|
|
|
|
_ = logging.SetLogLevel("drand", "ERROR")
|
|
|
|
_ = logging.SetLogLevel("chainstore", "ERROR")
|
2019-12-09 15:09:23 +00:00
|
|
|
|
|
|
|
local := []*cli.Command{
|
2022-07-20 15:57:00 +00:00
|
|
|
addressCmd,
|
2023-01-06 23:02:36 +00:00
|
|
|
statActorCmd,
|
|
|
|
statObjCmd,
|
2021-03-24 03:32:56 +00:00
|
|
|
base64Cmd,
|
2019-12-09 15:09:23 +00:00
|
|
|
base32Cmd,
|
|
|
|
base16Cmd,
|
2020-04-28 08:41:59 +00:00
|
|
|
bitFieldCmd,
|
2023-03-20 09:37:48 +00:00
|
|
|
chainwatchCmd,
|
2021-04-23 03:03:53 +00:00
|
|
|
cronWcCmd,
|
2020-10-22 14:07:42 +00:00
|
|
|
frozenMinersCmd,
|
2022-03-12 23:11:10 +00:00
|
|
|
dealLabelCmd,
|
2019-12-09 15:09:23 +00:00
|
|
|
keyinfoCmd,
|
2020-08-19 19:18:36 +00:00
|
|
|
jwtCmd,
|
2019-12-13 14:47:21 +00:00
|
|
|
noncefix,
|
2020-01-31 02:13:53 +00:00
|
|
|
bigIntParseCmd,
|
2020-07-23 22:32:28 +00:00
|
|
|
staterootCmd,
|
2020-09-05 03:01:36 +00:00
|
|
|
auditsCmd,
|
2020-04-02 03:27:06 +00:00
|
|
|
importCarCmd,
|
2020-08-31 21:24:23 +00:00
|
|
|
importObjectCmd,
|
2020-04-15 17:50:46 +00:00
|
|
|
commpToCidCmd,
|
2020-05-07 05:20:17 +00:00
|
|
|
fetchParamCmd,
|
2020-10-13 03:09:40 +00:00
|
|
|
postFindCmd,
|
2020-05-20 17:10:35 +00:00
|
|
|
proofsCmd,
|
2020-05-14 23:11:03 +00:00
|
|
|
verifRegCmd,
|
2021-01-05 06:08:19 +00:00
|
|
|
marketCmd,
|
2020-07-22 17:14:45 +00:00
|
|
|
miscCmd,
|
|
|
|
mpoolCmd,
|
2022-06-02 03:51:11 +00:00
|
|
|
helloCmd,
|
2020-08-21 01:10:11 +00:00
|
|
|
genesisVerifyCmd,
|
2020-09-05 00:40:57 +00:00
|
|
|
mathCmd,
|
2021-03-12 11:24:09 +00:00
|
|
|
minerCmd,
|
2020-08-31 23:37:18 +00:00
|
|
|
mpoolStatsCmd,
|
2020-09-11 00:28:25 +00:00
|
|
|
exportChainCmd,
|
2023-01-19 13:49:47 +00:00
|
|
|
ethCmd,
|
2021-01-28 02:35:28 +00:00
|
|
|
exportCarCmd,
|
2020-09-20 20:16:20 +00:00
|
|
|
consensusCmd,
|
2020-09-27 21:52:26 +00:00
|
|
|
syncCmd,
|
2020-09-16 03:20:48 +00:00
|
|
|
stateTreePruneCmd,
|
2020-09-30 13:17:29 +00:00
|
|
|
datastoreCmd,
|
2020-10-10 03:17:04 +00:00
|
|
|
ledgerCmd,
|
2020-10-20 21:19:42 +00:00
|
|
|
sectorsCmd,
|
2020-10-23 19:51:10 +00:00
|
|
|
msgCmd,
|
2020-10-20 15:36:23 +00:00
|
|
|
electionCmd,
|
2020-11-02 18:09:28 +00:00
|
|
|
rpcCmd,
|
2020-11-04 15:20:57 +00:00
|
|
|
cidCmd,
|
2020-12-15 17:46:34 +00:00
|
|
|
blockmsgidCmd,
|
2021-03-24 04:00:11 +00:00
|
|
|
signaturesCmd,
|
2021-03-29 04:27:08 +00:00
|
|
|
actorCmd,
|
2021-05-01 04:15:45 +00:00
|
|
|
minerTypesCmd,
|
2021-10-20 00:47:43 +00:00
|
|
|
minerPeeridCmd,
|
2021-06-15 02:59:17 +00:00
|
|
|
minerMultisigsCmd,
|
2021-07-21 10:13:47 +00:00
|
|
|
splitstoreCmd,
|
2021-09-20 11:26:05 +00:00
|
|
|
fr32Cmd,
|
2021-10-06 23:11:14 +00:00
|
|
|
chainCmd,
|
2021-09-30 18:18:29 +00:00
|
|
|
balancerCmd,
|
2021-11-23 00:49:38 +00:00
|
|
|
sendCsvCmd,
|
2021-12-13 03:05:43 +00:00
|
|
|
terminationsCmd,
|
2021-12-20 01:44:19 +00:00
|
|
|
migrationsCmd,
|
2022-02-11 18:09:40 +00:00
|
|
|
diffCmd,
|
2022-03-10 18:31:36 +00:00
|
|
|
itestdCmd,
|
2022-09-15 07:34:24 +00:00
|
|
|
msigCmd,
|
2022-09-26 12:13:00 +00:00
|
|
|
fip36PollCmd,
|
2022-10-14 20:03:28 +00:00
|
|
|
invariantsCmd,
|
2022-11-14 21:46:45 +00:00
|
|
|
gasTraceCmd,
|
2022-11-16 20:07:23 +00:00
|
|
|
replayOfflineCmd,
|
2023-06-03 17:04:26 +00:00
|
|
|
indexesCmd,
|
2023-03-22 00:44:34 +00:00
|
|
|
FevmAnalyticsCmd,
|
2023-04-26 14:07:52 +00:00
|
|
|
mismatchesCmd,
|
2019-12-09 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
app := &cli.App{
|
|
|
|
Name: "lotus-shed",
|
|
|
|
Usage: "A place for all the lotus tools",
|
2022-06-14 22:56:31 +00:00
|
|
|
Version: build.UserVersion(),
|
2019-12-09 15:09:23 +00:00
|
|
|
Commands: local,
|
2020-03-07 00:46:55 +00:00
|
|
|
Flags: []cli.Flag{
|
2023-02-15 16:09:24 +00:00
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "repo",
|
|
|
|
EnvVars: []string{"LOTUS_PATH"},
|
|
|
|
Hidden: true,
|
|
|
|
Value: "~/.lotus", // TODO: Consider XDG_DATA_HOME
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "miner-repo",
|
|
|
|
Aliases: []string{"storagerepo"},
|
|
|
|
EnvVars: []string{"LOTUS_MINER_PATH", "LOTUS_STORAGE_PATH"},
|
|
|
|
Value: "~/.lotusminer", // TODO: Consider XDG_DATA_HOME
|
|
|
|
Usage: fmt.Sprintf("Specify miner repo path. flag storagerepo and env LOTUS_STORAGE_PATH are DEPRECATION, will REMOVE SOON"),
|
|
|
|
},
|
2020-09-20 20:16:20 +00:00
|
|
|
&cli.StringFlag{
|
|
|
|
Name: "log-level",
|
|
|
|
Value: "info",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Before: func(cctx *cli.Context) error {
|
|
|
|
return logging.SetLogLevel("lotus-shed", cctx.String("log-level"))
|
2020-03-07 00:46:55 +00:00
|
|
|
},
|
2019-12-09 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2023-05-16 11:25:57 +00:00
|
|
|
// terminate early on ctrl+c
|
|
|
|
c := make(chan os.Signal, 1)
|
|
|
|
signal.Notify(c, os.Interrupt)
|
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
go func() {
|
|
|
|
<-c
|
|
|
|
cancel()
|
2023-05-27 10:10:30 +00:00
|
|
|
fmt.Println("Received interrupt, shutting down... Press CTRL+C again to force shutdown")
|
2023-05-16 11:25:57 +00:00
|
|
|
<-c
|
|
|
|
fmt.Println("Forcing stop")
|
|
|
|
os.Exit(1)
|
|
|
|
}()
|
|
|
|
|
|
|
|
if err := app.RunContext(ctx, os.Args); err != nil {
|
2022-11-16 23:19:59 +00:00
|
|
|
log.Errorf("%+v", err)
|
2019-12-09 15:09:23 +00:00
|
|
|
os.Exit(1)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|