From 751bc45befc9a7f227bc70fd2dcb80fb509de938 Mon Sep 17 00:00:00 2001 From: laser Date: Mon, 8 Jun 2020 12:20:44 -0700 Subject: [PATCH 1/4] display a little inline warning if balance is zero --- cli/wallet.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cli/wallet.go b/cli/wallet.go index f9f749d72d1..ccca4d23d4a 100644 --- a/cli/wallet.go +++ b/cli/wallet.go @@ -113,7 +113,12 @@ var walletBalance = &cli.Command{ return err } - fmt.Printf("%s\n", types.FIL(balance)) + if balance.Equals(types.NewInt(0)) { + fmt.Printf("%s (warning: may display 0 if chain sync in progress)\n", types.FIL(balance)) + } else { + fmt.Printf("%s\n", types.FIL(balance)) + } + return nil }, } From 82c6be14f44bc14c9667e264a0d35123cd09a6de Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 12 Jun 2020 22:34:00 -0300 Subject: [PATCH 2/4] unchecked errs Signed-off-by: Ignacio Hagopian --- chain/gen/genesis/miners.go | 3 +++ cli/chain.go | 3 +++ cli/state.go | 11 ++++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/chain/gen/genesis/miners.go b/chain/gen/genesis/miners.go index 51a128d54d1..26f52eae0f3 100644 --- a/chain/gen/genesis/miners.go +++ b/chain/gen/genesis/miners.go @@ -239,6 +239,9 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid st.TotalQualityAdjPower = big.Sub(st.TotalQualityAdjPower, big.NewInt(1)) return nil }) + if err != nil { + return cid.Undef, xerrors.Errorf("mutating state: %w", err) + } c, err := vm.Flush(ctx) if err != nil { diff --git a/cli/chain.go b/cli/chain.go index cbdd957e9fa..0dfcb926a9d 100644 --- a/cli/chain.go +++ b/cli/chain.go @@ -221,6 +221,9 @@ var chainStatObjCmd = &cli.Command{ base := cid.Undef if cctx.IsSet("base") { base, err = cid.Decode(cctx.String("base")) + if err != nil { + return err + } } stats, err := api.ChainStatObj(ctx, obj, base) diff --git a/cli/state.go b/cli/state.go index 6b5c9035b9e..910b9557a5e 100644 --- a/cli/state.go +++ b/cli/state.go @@ -359,7 +359,7 @@ var stateReplaySetCmd = &cli.Command{ return fmt.Errorf("message cid was invalid: %s", err) } - api, closer, err := GetFullNodeAPI(cctx) + fapi, closer, err := GetFullNodeAPI(cctx) if err != nil { return err } @@ -381,7 +381,7 @@ var stateReplaySetCmd = &cli.Command{ if len(tscids) > 0 { var headers []*types.BlockHeader for _, c := range tscids { - h, err := api.ChainGetBlock(ctx, c) + h, err := fapi.ChainGetBlock(ctx, c) if err != nil { return err } @@ -391,12 +391,13 @@ var stateReplaySetCmd = &cli.Command{ ts, err = types.NewTipSet(headers) } else { - r, err := api.StateWaitMsg(ctx, mcid) + var r *api.MsgLookup + r, err = fapi.StateWaitMsg(ctx, mcid) if err != nil { return xerrors.Errorf("finding message in chain: %w", err) } - ts, err = api.ChainGetTipSet(ctx, r.TipSet.Parents()) + ts, err = fapi.ChainGetTipSet(ctx, r.TipSet.Parents()) } if err != nil { return err @@ -404,7 +405,7 @@ var stateReplaySetCmd = &cli.Command{ } - res, err := api.StateReplay(ctx, ts.Key(), mcid) + res, err := fapi.StateReplay(ctx, ts.Key(), mcid) if err != nil { return xerrors.Errorf("replay call failed: %w", err) } From 6d36c030e0cafcf99c17c2c77846a60ee9568981 Mon Sep 17 00:00:00 2001 From: chunqizhi <1558763837@qq.com> Date: Sat, 13 Jun 2020 18:05:30 +0800 Subject: [PATCH 3/4] Add usage information for provingInfoCmd --- cmd/lotus-storage-miner/proving.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/lotus-storage-miner/proving.go b/cmd/lotus-storage-miner/proving.go index 7cfa010b9a3..60e85e0d8c5 100644 --- a/cmd/lotus-storage-miner/proving.go +++ b/cmd/lotus-storage-miner/proving.go @@ -16,6 +16,7 @@ import ( var provingCmd = &cli.Command{ Name: "proving", + Usage:"View proving information", Subcommands: []*cli.Command{ provingInfoCmd, provingDeadlinesCmd, @@ -24,6 +25,7 @@ var provingCmd = &cli.Command{ var provingInfoCmd = &cli.Command{ Name: "info", + Usage:"View current state information", Action: func(cctx *cli.Context) error { nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx) if err != nil { @@ -146,6 +148,7 @@ func epochTime(curr, e abi.ChainEpoch) string { var provingDeadlinesCmd = &cli.Command{ Name: "deadlines", + Usage:"View the current proving period deadlines information", Action: func(cctx *cli.Context) error { nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx) if err != nil { From 12056c8904a41fcf398a5eb0dd299551ef9a44c4 Mon Sep 17 00:00:00 2001 From: chunqizhi <1558763837@qq.com> Date: Mon, 15 Jun 2020 17:43:42 +0800 Subject: [PATCH 4/4] go fmt --- cmd/lotus-storage-miner/proving.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/lotus-storage-miner/proving.go b/cmd/lotus-storage-miner/proving.go index 60e85e0d8c5..d419efd7b62 100644 --- a/cmd/lotus-storage-miner/proving.go +++ b/cmd/lotus-storage-miner/proving.go @@ -15,8 +15,8 @@ import ( ) var provingCmd = &cli.Command{ - Name: "proving", - Usage:"View proving information", + Name: "proving", + Usage: "View proving information", Subcommands: []*cli.Command{ provingInfoCmd, provingDeadlinesCmd, @@ -24,8 +24,8 @@ var provingCmd = &cli.Command{ } var provingInfoCmd = &cli.Command{ - Name: "info", - Usage:"View current state information", + Name: "info", + Usage: "View current state information", Action: func(cctx *cli.Context) error { nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx) if err != nil { @@ -147,8 +147,8 @@ func epochTime(curr, e abi.ChainEpoch) string { } var provingDeadlinesCmd = &cli.Command{ - Name: "deadlines", - Usage:"View the current proving period deadlines information", + Name: "deadlines", + Usage: "View the current proving period deadlines information", Action: func(cctx *cli.Context) error { nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx) if err != nil {