Skip to content

Commit

Permalink
Merge pull request #43 from algorandfoundation/fix/fast-catchup
Browse files Browse the repository at this point in the history
fix: fast catchup (beta)
  • Loading branch information
PhearZero authored Dec 11, 2024
2 parents 18c77b0 + 1992cfe commit 691972c
Show file tree
Hide file tree
Showing 62 changed files with 141 additions and 141 deletions.
2 changes: 1 addition & 1 deletion .docker/start_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if [ -d "$ALGORAND_DATA" ]; then
algod -o -d "$ALGORAND_DATA" -l "0.0.0.0:8080"
else
sed -i "s/NUM_ROUNDS/${NUM_ROUNDS:-30000}/" "/node/run/template.json"
sed -i "s/\"NetworkName\": \"\"/\"NetworkName\": \"hack-tui\"/" "/node/run/template.json"
sed -i "s/\"NetworkName\": \"\"/\"NetworkName\": \"algorun-tui\"/" "/node/run/template.json"
goal network create --noclean -n tuinet -r "${ALGORAND_DATA}/.." -t "/node/run/template.json"

# Cycle Network
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hack-tui
algorun-tui
bin
.data

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ A guide on how to contribute to this project.
Clone the project

```bash
git clone [email protected]:algorandfoundation/hack-tui.git
git clone [email protected]:algorandfoundation/algorun-tui.git
```

Change to the directory

```bash
cd hack-tui
cd algorun-tui
```

Build the project
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# ⌨️ Hack-TUI
# ⌨️ AlgoRun-TUI

<div align="center">
<img alt="Terminal Render" src="/assets/Banner.gif" width="65%">
</div>

<div align="center">
<a target="_blank" href="https://github.com/algorandfoundation/hack-tui/actions/workflows/test.yaml">
<img alt="CI Badge" src="https://github.com/algorandfoundation/hack-tui/actions/workflows/test.yaml/badge.svg"/>
<a target="_blank" href="https://github.com/algorandfoundation/algorun-tui/actions/workflows/test.yaml">
<img alt="CI Badge" src="https://github.com/algorandfoundation/algorun-tui/actions/workflows/test.yaml/badge.svg"/>
</a>
<a target="_blank" href="https://github.com/algorandfoundation/hack-tui">
<a target="_blank" href="https://github.com/algorandfoundation/algorun-tui">
<img alt="CD Badge" src="https://img.shields.io/badge/CD-TODO-red"/>
</a>
<a target="_blank" href="https://github.com/algorandfoundation/hack-tui/stargazers">
<img alt="Repository Stars Badge" src="https://img.shields.io/github/stars/algorandfoundation/hack-tui?color=7B1E7A&logo=star&style=flat" />
<a target="_blank" href="https://github.com/algorandfoundation/algorun-tui/stargazers">
<img alt="Repository Stars Badge" src="https://img.shields.io/github/stars/algorandfoundation/algorun-tui?color=7B1E7A&logo=star&style=flat" />
</a>
<img alt="Repository Visitors Badge" src="https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2Falgorandfoundation%2Fhack-tui&countColor=%237B1E7A&style=flat" />
<img alt="Repository Visitors Badge" src="https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2Falgorandfoundation%2Falgorun-tui&countColor=%237B1E7A&style=flat" />
</div>

---
Expand All @@ -30,7 +30,7 @@ Built with [bubbles](https://github.com/charmbracelet/bubbles) & [bubbletea](htt
Download the latest release by running

```bash
curl -fsSL https://raw.githubusercontent.com/algorandfoundation/hack-tui/refs/heads/main/install.sh | bash
curl -fsSL https://raw.githubusercontent.com/algorandfoundation/algorun-tui/refs/heads/main/install.sh | bash
```

Launch the TUI by replacing the `<ENDPOINT>` and `<TOKEN>`
Expand Down
10 changes: 5 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/algorandfoundation/hack-tui/api"
"github.com/algorandfoundation/hack-tui/internal"
"github.com/algorandfoundation/hack-tui/ui"
"github.com/algorandfoundation/hack-tui/ui/explanations"
"github.com/algorandfoundation/hack-tui/ui/style"
"github.com/algorandfoundation/algorun-tui/api"
"github.com/algorandfoundation/algorun-tui/internal"
"github.com/algorandfoundation/algorun-tui/ui"
"github.com/algorandfoundation/algorun-tui/ui/explanations"
"github.com/algorandfoundation/algorun-tui/ui/style"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/log"
Expand Down
6 changes: 3 additions & 3 deletions cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"errors"
"fmt"
"github.com/algorandfoundation/hack-tui/internal"
"github.com/algorandfoundation/hack-tui/ui"
"github.com/algorandfoundation/hack-tui/ui/style"
"github.com/algorandfoundation/algorun-tui/internal"
"github.com/algorandfoundation/algorun-tui/ui"
"github.com/algorandfoundation/algorun-tui/ui/style"
tea "github.com/charmbracelet/bubbletea"
"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/algorandfoundation/hack-tui
module github.com/algorandfoundation/algorun-tui

go 1.22.0

Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ EOF
)

os=$(uname -ms)
release="https://github.com/algorandfoundation/hack-tui/releases/download"
release="https://github.com/algorandfoundation/algorun-tui/releases/download"
version="v1.0.0-beta.1"

Red=''
Expand Down
2 changes: 1 addition & 1 deletion internal/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"time"

"github.com/algorand/go-algorand-sdk/v2/types"
"github.com/algorandfoundation/hack-tui/api"
"github.com/algorandfoundation/algorun-tui/api"
)

// Account represents a user's account, including address, status, balance, and number of keys.
Expand Down
6 changes: 3 additions & 3 deletions internal/accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package internal

import (
"context"
"github.com/algorandfoundation/hack-tui/api"
"github.com/algorandfoundation/hack-tui/internal/test"
"github.com/algorandfoundation/hack-tui/internal/test/mock"
"github.com/algorandfoundation/algorun-tui/api"
"github.com/algorandfoundation/algorun-tui/internal/test"
"github.com/algorandfoundation/algorun-tui/internal/test/mock"
"github.com/oapi-codegen/oapi-codegen/v2/pkg/securityprovider"
"github.com/stretchr/testify/assert"
"testing"
Expand Down
2 changes: 1 addition & 1 deletion internal/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package internal
import (
"context"
"errors"
"github.com/algorandfoundation/hack-tui/api"
"github.com/algorandfoundation/algorun-tui/api"
"time"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package internal

import (
"context"
"github.com/algorandfoundation/hack-tui/api"
"github.com/algorandfoundation/algorun-tui/api"
"testing"
"time"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package internal
import (
"context"
"errors"
"github.com/algorandfoundation/hack-tui/api"
"github.com/algorandfoundation/algorun-tui/api"
"regexp"
"strconv"
"strings"
Expand Down
2 changes: 1 addition & 1 deletion internal/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package internal

import (
"context"
"github.com/algorandfoundation/hack-tui/internal/test"
"github.com/algorandfoundation/algorun-tui/internal/test"
"strconv"
"testing"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/participation.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"time"

"github.com/algorandfoundation/hack-tui/api"
"github.com/algorandfoundation/algorun-tui/api"
)

// GetPartKeys get the participation keys from the node
Expand Down
6 changes: 3 additions & 3 deletions internal/participation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package internal
import (
"context"
"fmt"
"github.com/algorandfoundation/hack-tui/api"
"github.com/algorandfoundation/hack-tui/internal/test"
"github.com/algorandfoundation/hack-tui/internal/test/mock"
"github.com/algorandfoundation/algorun-tui/api"
"github.com/algorandfoundation/algorun-tui/internal/test"
"github.com/algorandfoundation/algorun-tui/internal/test/mock"
"testing"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"errors"
"time"

"github.com/algorandfoundation/hack-tui/api"
"github.com/algorandfoundation/algorun-tui/api"
)

type StateModel struct {
Expand Down Expand Up @@ -75,7 +75,7 @@ func (s *StateModel) Watch(cb func(model *StateModel, err error), ctx context.Co
s.Status.State = "Unknown"

// Update Status
s.Status.Update(status.JSON200.LastRound, status.JSON200.CatchupTime, status.JSON200.CatchpointAcquiredBlocks, status.JSON200.UpgradeNodeVote)
s.Status.Update(status.JSON200.LastRound, status.JSON200.CatchupTime, status.JSON200.Catchpoint, status.JSON200.UpgradeNodeVote)

// Fetch Keys
s.UpdateKeys()
Expand Down
2 changes: 1 addition & 1 deletion internal/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package internal

import (
"context"
"github.com/algorandfoundation/hack-tui/api"
"github.com/algorandfoundation/algorun-tui/api"
"github.com/oapi-codegen/oapi-codegen/v2/pkg/securityprovider"
"testing"
"time"
Expand Down
8 changes: 4 additions & 4 deletions internal/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/algorandfoundation/hack-tui/api"
"github.com/algorandfoundation/algorun-tui/api"
)

type State string
Expand All @@ -29,10 +29,10 @@ type StatusModel struct {
func (m *StatusModel) String() string {
return fmt.Sprintf("\nLastRound: %d\n", m.LastRound)
}
func (m *StatusModel) Update(lastRound int, catchupTime int, aquiredBlocks *int, upgradeNodeVote *bool) {
func (m *StatusModel) Update(lastRound int, catchupTime int, catchpoint *string, upgradeNodeVote *bool) {
m.LastRound = uint64(lastRound)
if catchupTime > 0 {
if aquiredBlocks != nil {
if catchpoint != nil && *catchpoint != "" {
m.State = FastCatchupState
} else {
m.State = SyncingState
Expand Down Expand Up @@ -77,6 +77,6 @@ func (m *StatusModel) Fetch(ctx context.Context, client api.ClientWithResponsesI
return fmt.Errorf("Status code %d: %s", s.StatusCode(), s.Status())
}

m.Update(s.JSON200.LastRound, s.JSON200.CatchupTime, s.JSON200.CatchpointAcquiredBlocks, s.JSON200.UpgradeNodeVote)
m.Update(s.JSON200.LastRound, s.JSON200.CatchupTime, s.JSON200.Catchpoint, s.JSON200.UpgradeNodeVote)
return nil
}
2 changes: 1 addition & 1 deletion internal/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package internal

import (
"context"
"github.com/algorandfoundation/hack-tui/internal/test"
"github.com/algorandfoundation/algorun-tui/internal/test"
"strings"
"testing"
)
Expand Down
4 changes: 2 additions & 2 deletions internal/test/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package test
import (
"context"
"errors"
"github.com/algorandfoundation/hack-tui/api"
"github.com/algorandfoundation/hack-tui/internal/test/mock"
"github.com/algorandfoundation/algorun-tui/api"
"github.com/algorandfoundation/algorun-tui/internal/test/mock"
"net/http"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/test/mock/fixtures.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mock

import (
"github.com/algorandfoundation/hack-tui/api"
"github.com/algorandfoundation/algorun-tui/api"
)

var VoteKey = []byte("TESTKEY")
Expand Down
2 changes: 1 addition & 1 deletion internal/test/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/algorandfoundation/hack-tui/api"
"github.com/algorandfoundation/algorun-tui/api"
"io"
)

Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"github.com/algorandfoundation/hack-tui/cmd"
"github.com/algorandfoundation/algorun-tui/cmd"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Example for `status.go` single file component:
```go
package ui

import "github.com/algorandfoundation/hack-tui/internal"
import "github.com/algorandfoundation/algorun-tui/internal"

type StatusViewModel struct {
Data internal.StateModel
Expand All @@ -34,7 +34,7 @@ Example refactor for `status.go` to a package:
#### ui/status/model.go
```go
package status
import "github.com/algorandfoundation/hack-tui/internal"
import "github.com/algorandfoundation/algorun-tui/internal"

type ViewModel struct {
Data internal.StateModel
Expand Down
2 changes: 1 addition & 1 deletion ui/app/accounts.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package app

import (
"github.com/algorandfoundation/hack-tui/internal"
"github.com/algorandfoundation/algorun-tui/internal"
tea "github.com/charmbracelet/bubbletea"
)

Expand Down
6 changes: 3 additions & 3 deletions ui/app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package app

import (
"context"
"github.com/algorandfoundation/hack-tui/internal"
"github.com/algorandfoundation/hack-tui/internal/test"
uitest "github.com/algorandfoundation/hack-tui/ui/internal/test"
"github.com/algorandfoundation/algorun-tui/internal"
"github.com/algorandfoundation/algorun-tui/internal/test"
uitest "github.com/algorandfoundation/algorun-tui/ui/internal/test"
"testing"
"time"
)
Expand Down
4 changes: 2 additions & 2 deletions ui/app/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"time"

"github.com/algorandfoundation/hack-tui/api"
"github.com/algorandfoundation/hack-tui/internal"
"github.com/algorandfoundation/algorun-tui/api"
"github.com/algorandfoundation/algorun-tui/internal"
tea "github.com/charmbracelet/bubbletea"
)

Expand Down
2 changes: 1 addition & 1 deletion ui/app/modal.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package app

import (
"github.com/algorandfoundation/hack-tui/api"
"github.com/algorandfoundation/algorun-tui/api"
tea "github.com/charmbracelet/bubbletea"
)

Expand Down
2 changes: 1 addition & 1 deletion ui/explanations/explanations.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package explanations

import (
"github.com/algorandfoundation/hack-tui/ui/style"
"github.com/algorandfoundation/algorun-tui/ui/style"
)

var NodeNotFound = "\n\nExplanation: algorun could not find your node automatically. Provide --algod-endpoint and --algod-token, or set the goal-compatible ALGORAND_DATA environment variable to the algod data directory, e.g. /var/lib/algorand\n"
Expand Down
6 changes: 3 additions & 3 deletions ui/internal/test/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package test

import (
"context"
"github.com/algorandfoundation/hack-tui/api"
"github.com/algorandfoundation/hack-tui/internal"
mock2 "github.com/algorandfoundation/hack-tui/internal/test/mock"
"github.com/algorandfoundation/algorun-tui/api"
"github.com/algorandfoundation/algorun-tui/internal"
mock2 "github.com/algorandfoundation/algorun-tui/internal/test/mock"
"time"
)

Expand Down
8 changes: 4 additions & 4 deletions ui/modal/controller.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package modal

import (
"github.com/algorandfoundation/hack-tui/internal"
"github.com/algorandfoundation/hack-tui/ui/app"
"github.com/algorandfoundation/hack-tui/ui/modals/generate"
"github.com/algorandfoundation/hack-tui/ui/style"
"github.com/algorandfoundation/algorun-tui/internal"
"github.com/algorandfoundation/algorun-tui/ui/app"
"github.com/algorandfoundation/algorun-tui/ui/modals/generate"
"github.com/algorandfoundation/algorun-tui/ui/style"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
)
Expand Down
Loading

0 comments on commit 691972c

Please sign in to comment.