Repository: coinbase/rosetta-cli (go)

Issue:
Panic when using `height` end condition for check:data
The following panic is thrown when specifying the recently introduced `end_conditions.reconciliation_coverage.height` end condition without also specifiying `tip` or `from_tip`:

To be clearer, the end condition config was:

```js
{
// ....
"end_conditions": {
  "reconciliation_coverage": {
    "coverage": 1.0,
    "height": 150,
  }
}
```
  

```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9ecce8]

goroutine 68 [running]:
github.com/coinbase/rosetta-cli/pkg/tester.(*DataTester).EndReconciliationCoverage(0xc00023c0a0, 0xe26a80, 0xc0000ac2c0, 0xc00016e320)
        /home/user/testes/vendor/coinbase/rosetta-cli/pkg/tester/data.go:467 +0x1c8
created by github.com/coinbase/rosetta-cli/pkg/tester.(*DataTester).WatchEndConditions
        /home/user/testes/vendor/coinbase/rosetta-cli/pkg/tester/data.go:559 +0xb7
```

Pull request:
[BUG] Reconciliation Coverage End Condition Panic
Fixes #156 

This PR fixes a panic when running `end_conditions` with a minimum `index` for `reconciliation_coverage`.

### Changes
- [x] use `GetBlock` to ensure returned block is always populated (only populated in `AtTip` when at tip)
- [x] fix `configuration` to use `index` instead of `height`
- [x] update version to `v0.5.9`

Patch:
diff --git a/cmd/root.go b/cmd/root.go
index 7e7e4c7..f0f9ee0 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -217,6 +217,6 @@ var versionCmd = &cobra.Command{
 	Use:   "version",
 	Short: "Print rosetta-cli version",
 	Run: func(cmd *cobra.Command, args []string) {
-		fmt.Println("v0.5.8")
+		fmt.Println("v0.5.9")
 	},
 }
diff --git a/configuration/types.go b/configuration/types.go
index 902f52d..d0ec97c 100644
--- a/configuration/types.go
+++ b/configuration/types.go
@@ -172,7 +172,7 @@ type ReconciliationCoverage struct {
 
 	// Index is an int64 indicating the height that must be
 	// reached before reconciliation coverage is considered valid.
-	Index *int64 `json:"height,omitempty"`
+	Index *int64 `json:"index,omitempty"`
 
 	// AccountCount is an int64 indicating the number of accounts
 	// that must be observed before reconciliation coverage is considered


Test patch:
diff --git a/pkg/tester/data.go b/pkg/tester/data.go
index 09a9f0e..a790b13 100644
--- a/pkg/tester/data.go
+++ b/pkg/tester/data.go
@@ -436,7 +436,10 @@ func (t *DataTester) EndReconciliationCoverage( // nolint:gocognit
 			return
 
 		case <-tc.C:
-			atTip, blockIdentifier, err := t.blockStorage.AtTip(ctx, t.config.TipDelay)
+			headBlock, err := t.blockStorage.GetBlock(ctx, nil)
+			if errors.Is(err, storage.ErrHeadBlockNotFound) {
+				continue
+			}
 			if err != nil {
 				log.Printf(
 					"%s: unable to evaluate syncer height or if at tip",
@@ -445,7 +448,10 @@ func (t *DataTester) EndReconciliationCoverage( // nolint:gocognit
 				continue
 			}
 
-			// Only check coverage if we are at tip.
+			blockIdentifier := headBlock.BlockIdentifier
+			atTip := utils.AtTip(t.config.TipDelay, headBlock.Timestamp)
+
+			// Check if we are at tip and set tip height if fromTip is true.
 			if reconciliationCoverage.Tip || reconciliationCoverage.FromTip {
 				// If we fall behind tip, we must reset the firstTipIndex.
 				if !atTip {