From 6d32a2f29950c48f3e21db57da27e03dae896261 Mon Sep 17 00:00:00 2001 From: Florian Ruen Date: Thu, 17 Feb 2022 17:35:33 +0100 Subject: [PATCH 1/5] Update client.go Bug fixed : if hitting return instead of filling with a valid value, the CLI crashed (line 796) Change return err by continue to ask a valid value again --- cli/client.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cli/client.go b/cli/client.go index 634bd18e5b4..e9a25f5208a 100644 --- a/cli/client.go +++ b/cli/client.go @@ -795,14 +795,17 @@ uiLoop: case "find-count": afmt.Print("Deals to make (1): ") dealcStr, _, err := rl.ReadLine() + if err != nil { printErr(xerrors.Errorf("reading deal count: %w", err)) continue } dealCount, err = strconv.ParseInt(string(dealcStr), 10, 64) + if err != nil { - return err + printErr(xerrors.Errorf("reading deal count: invalid number")) + continue } color.Blue(".. Picking miners") From 78817bd0014f0e751824521ce483849d8f31a7d3 Mon Sep 17 00:00:00 2001 From: Florian Ruen Date: Thu, 17 Feb 2022 17:57:42 +0100 Subject: [PATCH 2/5] Fix #8100 Bug fixed : if hitting return instead of filling with a valid value, the CLI crashed (line 796) Change return err by continue to ask a valid value again --- cli/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/client.go b/cli/client.go index e9a25f5208a..ae8ad857e31 100644 --- a/cli/client.go +++ b/cli/client.go @@ -801,10 +801,10 @@ uiLoop: continue } - dealCount, err = strconv.ParseInt(string(dealcStr), 10, 64) + dealCount, err = strconv.ParseInt(string(dealcStr), 10, 64) if err != nil { - printErr(xerrors.Errorf("reading deal count: invalid number")) + printErr(xerrors.Errorf("reading deal count: invalid number")) // TO DO : Use 1 as default value for number of deals ? continue } From ddd369e7319590194087f3ecf60f08ddc6713aa4 Mon Sep 17 00:00:00 2001 From: Florian Ruen Date: Thu, 17 Feb 2022 18:53:21 +0100 Subject: [PATCH 3/5] lint reported errors on CircleCI Commit to fix lint reported errors during tests on CircleCI (remove blank lines x2) --- cli/client.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cli/client.go b/cli/client.go index ae8ad857e31..68d57376d7c 100644 --- a/cli/client.go +++ b/cli/client.go @@ -795,16 +795,14 @@ uiLoop: case "find-count": afmt.Print("Deals to make (1): ") dealcStr, _, err := rl.ReadLine() - if err != nil { printErr(xerrors.Errorf("reading deal count: %w", err)) continue } dealCount, err = strconv.ParseInt(string(dealcStr), 10, 64) - if err != nil { - printErr(xerrors.Errorf("reading deal count: invalid number")) // TO DO : Use 1 as default value for number of deals ? + printErr(xerrors.Errorf("reading deal count: invalid number")) continue } From 6ce93210949f81adf1e1db45396c08c71f052b1c Mon Sep 17 00:00:00 2001 From: Florian Ruen Date: Thu, 17 Feb 2022 19:01:52 +0100 Subject: [PATCH 4/5] lint reported errors on CircleCI Commit to fix lint reported errors during tests on CircleCI (remove trailling whitespace) --- cli/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/client.go b/cli/client.go index 68d57376d7c..dc4ab86e630 100644 --- a/cli/client.go +++ b/cli/client.go @@ -800,7 +800,7 @@ uiLoop: continue } - dealCount, err = strconv.ParseInt(string(dealcStr), 10, 64) + dealCount, err = strconv.ParseInt(string(dealcStr), 10, 64) if err != nil { printErr(xerrors.Errorf("reading deal count: invalid number")) continue From 1c397305313e21754d0283e9de0b95767631bc43 Mon Sep 17 00:00:00 2001 From: "florian@eyesr.fr" Date: Fri, 18 Feb 2022 15:46:40 +0000 Subject: [PATCH 5/5] Fix #8095 Clear the list of miner addresses and successfull get-asked before asking for new ones Previous behavior : if get-ask failed for miner(s), the faulty miner will be retried each time, so you have to stop the command and start again to change this faulty miner (instead of removing from the list on the new attempt) --- cli/client.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cli/client.go b/cli/client.go index 634bd18e5b4..64114fa171b 100644 --- a/cli/client.go +++ b/cli/client.go @@ -667,6 +667,8 @@ uiLoop: state = "miner" case "miner": + maddrs = maddrs[:0] + ask = ask[:0] afmt.Print("Miner Addresses (f0.. f0..), none to find: ") _maddrsStr, _, err := rl.ReadLine() @@ -802,7 +804,8 @@ uiLoop: dealCount, err = strconv.ParseInt(string(dealcStr), 10, 64) if err != nil { - return err + printErr(xerrors.Errorf("reading deal count: invalid number")) + continue } color.Blue(".. Picking miners") @@ -859,12 +862,13 @@ uiLoop: a, err := api.ClientQueryAsk(ctx, *mi.PeerId, maddr) if err != nil { - printErr(xerrors.Errorf("failed to query ask: %w", err)) + printErr(xerrors.Errorf("failed to query ask for miner %s: %w", maddr.String(), err)) state = "miner" continue uiLoop } ask = append(ask, *a) + } // TODO: run more validation