Repository: coinbase/rosetta-cli (go)

Issue:
"Discrepancy" misspelled in types.go file
**Describe the bug**
`Discrepancy` is misspelled in the types.go file in the `InactiveDiscrepancySearchDisabled` type.

**To Reproduce**
Read the file.

**Expected behavior**
Discrepancy should be spelled correctly.



Pull request description:
Fix typos in types.go
Fixed misspelling of the word `discrepancy` in the `InactiveDiscrepancySearchDisabled` type in the types.go file.

Fixes #252.

### Motivation
Improve spelling in the code.

### Solution
Spelled `discrepancy` correctly.

### Open questions
This is my first PR, so please let me know whether I completed the process correctly. TIA.


Patch:
diff --git a/configuration/types.go b/configuration/types.go
index 817608a..1aa0a99 100644
--- a/configuration/types.go
+++ b/configuration/types.go
@@ -278,11 +278,11 @@ type DataConfiguration struct {
 	// been drained (if reconciliation is enabled).
 	ReconciliationDrainDisabled bool `json:"reconciliation_drain_disabled"`
 
-	// InactiveDiscrepencySearchDisabled is a boolean indicating if a search
-	// should be performed to find any inactive reconciliation discrepencies.
+	// InactiveDiscrepancySearchDisabled is a boolean indicating if a search
+	// should be performed to find any inactive reconciliation discrepancies.
 	// Note, a search will never be performed if historical balance lookup
 	// is disabled.
-	InactiveDiscrepencySearchDisabled bool `json:"inactive_discrepency_search_disabled"`
+	InactiveDiscrepancySearchDisabled bool `json:"inactive_discrepancy_search_disabled"`
 
 	// BalanceTrackingDisabled is a boolean that indicates balances calculation
 	// should not be attempted. When first testing an implemenation, it can be
@@ -301,7 +301,7 @@ type DataConfiguration struct {
 	// If no blocks have ever been synced, syncing will start from genesis.
 	StartIndex *int64 `json:"start_index,omitempty"`
 
-	// EndCondition contains the conditions for the syncer to stop
+	// EndCondition contains the conditions for the syncer to stop.
 	EndConditions *DataEndConditions `json:"end_conditions,omitempty"`
 
 	// StatusPort allows the caller to query a running check:data
@@ -421,6 +421,10 @@ type Configuration struct {
 	// specific validation will be done
 	ValidationFile string `json:"validation_file,omitempty"`
 
+	// ErrorStackTraceEnabled if true then it will print error stack trace
+	// if the data or construction check fails
+	ErrorStackTraceEnabled bool `json:"error_stack_trace_enabled"`
+
 	Construction *ConstructionConfiguration `json:"construction"`
 	Data         *DataConfiguration         `json:"data"`
 }
diff --git a/examples/configuration/default.json b/examples/configuration/default.json
index 1d5a448..33792cd 100644
--- a/examples/configuration/default.json
+++ b/examples/configuration/default.json
@@ -15,6 +15,7 @@
  "log_configuration": false,
  "compression_disabled": false,
  "memory_limit_disabled": false,
+ "error_stack_trace_enabled": false,
  "construction": null,
  "data": {
   "active_reconciliation_concurrency": 16,
@@ -30,7 +31,7 @@
   "interesting_accounts": "",
   "reconciliation_disabled": false,
   "reconciliation_drain_disabled": false,
-  "inactive_discrepency_search_disabled": false,
+  "inactive_discrepancy_search_disabled": false,
   "balance_tracking_disabled": false,
   "coin_tracking_disabled": false,
   "status_port": 9090,
diff --git a/examples/configuration/simple.json b/examples/configuration/simple.json
index cbf8755..adbbd21 100644
--- a/examples/configuration/simple.json
+++ b/examples/configuration/simple.json
@@ -10,7 +10,7 @@
  "data": {
   "historical_balance_enabled": false,
   "reconciliation_disabled": true,
-  "inactive_discrepency_search_disabled": true,
+  "inactive_discrepancy_search_disabled": true,
   "balance_tracking_disabled": true,
   "end_conditions": {
     "tip": true
diff --git a/go.mod b/go.mod
index 17f9826..25fcab9 100644
--- a/go.mod
+++ b/go.mod
@@ -6,6 +6,7 @@ require (
 	github.com/coinbase/rosetta-sdk-go v0.7.1
 	github.com/fatih/color v1.13.0
 	github.com/olekukonko/tablewriter v0.0.5
+	github.com/pkg/errors v0.9.1
 	github.com/spf13/cobra v1.2.1
 	github.com/stretchr/testify v1.7.0
 	golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
diff --git a/pkg/results/construction_results.go b/pkg/results/construction_results.go
index 22f8b65..82957c3 100644
--- a/pkg/results/construction_results.go
+++ b/pkg/results/construction_results.go
@@ -21,6 +21,8 @@ import (
 	"os"
 	"strconv"
 
+	pkgError "github.com/pkg/errors"
+
 	"github.com/coinbase/rosetta-cli/configuration"
 
 	"github.com/coinbase/rosetta-sdk-go/storage/modules"
@@ -83,7 +85,7 @@ func ComputeCheckConstructionResults(
 	}
 
 	if err != nil {
-		results.Error = err.Error()
+		results.Error = fmt.Sprintf("%+v", err)
 
 		// We never want to populate an end condition
 		// if there was an error!
@@ -291,7 +293,7 @@ func FetchCheckConstructionStatus(url string) (*CheckConstructionStatus, error)
 	return &status, nil
 }
 
-// ExitConstruction exits check:data, logs the test results to the console,
+// ExitConstruction exits check:construction, logs the test results to the console,
 // and to a provided output path.
 func ExitConstruction(
 	config *configuration.Configuration,
@@ -299,6 +301,10 @@ func ExitConstruction(
 	jobStorage *modules.JobStorage,
 	err error,
 ) error {
+	if config.ErrorStackTraceEnabled {
+		err = pkgError.WithStack(err)
+	}
+
 	results := ComputeCheckConstructionResults(
 		config,
 		err,
diff --git a/pkg/results/data_results.go b/pkg/results/data_results.go
index e2aca1c..b765174 100644
--- a/pkg/results/data_results.go
+++ b/pkg/results/data_results.go
@@ -23,6 +23,8 @@ import (
 	"os"
 	"strconv"
 
+	pkgError "github.com/pkg/errors"
+
 	"github.com/coinbase/rosetta-cli/configuration"
 
 	"github.com/coinbase/rosetta-sdk-go/asserter"
@@ -308,7 +310,7 @@ func ComputeCheckDataProgress(
 
 	genesisBlockIndex := int64(0)
 	if networkStatus.GenesisBlockIdentifier != nil {
-		genesisBlockIndex =  networkStatus.GenesisBlockIdentifier.Index
+		genesisBlockIndex = networkStatus.GenesisBlockIdentifier.Index
 	}
 
 	// Get current tip in the case that re-orgs occurred
@@ -368,8 +370,8 @@ func ComputeCheckDataProgress(
 	blocksSynced := new(
 		big.Float,
 	).Quo(
-		new(big.Float).SetInt64(headBlock.Index - genesisBlockIndex),
-		new(big.Float).SetInt64(tipIndex - genesisBlockIndex),
+		new(big.Float).SetInt64(headBlock.Index-genesisBlockIndex),
+		new(big.Float).SetInt64(tipIndex-genesisBlockIndex),
 	)
 	blocksSyncedFloat, _ := blocksSynced.Float64()
 
@@ -669,7 +671,7 @@ func ComputeCheckDataResults(
 	}
 
 	if err != nil {
-		results.Error = err.Error()
+		results.Error = fmt.Sprintf("%+v", err)
 
 		// If all tests pass, but we still encountered an error,
 		// then we hard exit without showing check:data results
@@ -707,6 +709,10 @@ func ExitData(
 	endCondition configuration.CheckDataEndCondition,
 	endConditionDetail string,
 ) error {
+	if config.ErrorStackTraceEnabled {
+		err = pkgError.WithStack(err)
+	}
+
 	results := ComputeCheckDataResults(
 		config,
 		err,


Test patch:
diff --git a/configuration/configuration_test.go b/configuration/configuration_test.go
index bdc9125..9328be0 100644
--- a/configuration/configuration_test.go
+++ b/configuration/configuration_test.go
@@ -62,15 +62,16 @@ var (
 			Blockchain: "sweet",
 			Network:    "sweeter",
 		},
-		OnlineURL:            "http://hasudhasjkdk",
-		MaxOnlineConnections: 10,
-		HTTPTimeout:          21,
-		MaxRetries:           1000,
-		MaxSyncConcurrency:   12,
-		TipDelay:             1231,
-		MaxReorgDepth:        12,
-		SeenBlockWorkers:     300,
-		SerialBlockWorkers:   200,
+		OnlineURL:              "http://hasudhasjkdk",
+		MaxOnlineConnections:   10,
+		HTTPTimeout:            21,
+		MaxRetries:             1000,
+		MaxSyncConcurrency:     12,
+		TipDelay:               1231,
+		MaxReorgDepth:          12,
+		SeenBlockWorkers:       300,
+		SerialBlockWorkers:     200,
+		ErrorStackTraceEnabled: true,
 		Construction: &ConstructionConfiguration{
 			OfflineURL:            "https://ashdjaksdkjshdk",
 			MaxOfflineConnections: 21,
diff --git a/pkg/tester/data.go b/pkg/tester/data.go
index 336664c..1ca4ed8 100644
--- a/pkg/tester/data.go
+++ b/pkg/tester/data.go
@@ -931,8 +931,8 @@ func (t *DataTester) HandleErr(err error, sigListeners *[]context.CancelFunc) er
 		)
 	}
 
-	if t.config.Data.InactiveDiscrepencySearchDisabled {
-		color.Yellow("Search for inactive reconciliation discrepency is disabled")
+	if t.config.Data.InactiveDiscrepancySearchDisabled {
+		color.Yellow("Search for inactive reconciliation discrepancy is disabled")
 		return results.ExitData(
 			t.config,
 			t.counterStorage,