Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Rebranding) refactor internal variables and strings in node #2172

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion node/cmd/fetcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func main() {
}()

log.Info().Msg("Syncing orakl config")
err := admin.SyncOraklConfig(ctx)
err := admin.SyncMikoConfig(ctx)
if err != nil {
log.Error().Err(err).Msg("Failed to sync orakl config")
return
Expand Down
2 changes: 1 addition & 1 deletion node/cmd/node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func main() {
}()

log.Info().Msg("Syncing orakl config")
err = admin.SyncOraklConfig(ctx)
err = admin.SyncMikoConfig(ctx)
if err != nil {
log.Error().Err(err).Msg("Failed to sync orakl config")
return
Expand Down
4 changes: 2 additions & 2 deletions node/pkg/admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func Run(ctx context.Context, bus *bus.MessageBus) error {

v1 := app.Group("/api/v1")
v1.Get("/", func(c *fiber.Ctx) error {
return c.SendString("Orakl Node Admin API")
return c.SendString("Miko Node Admin API")
})

feed.Routes(v1)
Expand All @@ -57,6 +57,6 @@ func Run(ctx context.Context, bus *bus.MessageBus) error {
return nil
}

func SyncOraklConfig(ctx context.Context) error {
func SyncMikoConfig(ctx context.Context) error {
return config.InitSyncDb(ctx)
}
2 changes: 1 addition & 1 deletion node/pkg/admin/tests/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestConfigSync(t *testing.T) {
}
assert.Greater(t, len(readResult), 1)

// should remove previously inserted config and feed which doesn't exist in orakl-config
// should remove previously inserted config and feed which doesn't exist in miko-config
readTmpConfigResult, err := GetRequest[config.ConfigModel](testItems.app, "/api/v1/config/"+strconv.Itoa(int(testItems.tmpData.config.ID)), nil)
if err != nil {
t.Fatalf("error getting config: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion node/pkg/api/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func Setup(options ...string) (AppConfig, error) {
}

app := fiber.New(fiber.Config{
AppName: "Orakl API " + version,
AppName: "Miko API " + version,
EnablePrintRoutes: true,
ErrorHandler: CustomErrorHandler,
})
Expand Down
2 changes: 1 addition & 1 deletion node/pkg/boot/boot.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func Run(ctx context.Context) error {

v1 := app.Group("/api/v1")
v1.Get("/", func(c *fiber.Ctx) error {
return c.SendString("Orakl Node Boot API")
return c.SendString("Miko Node Boot API")
})
peer.Routes(v1)

Expand Down
2 changes: 1 addition & 1 deletion node/pkg/boot/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func Setup(ctx context.Context, h *host.Host) (*fiber.App, error) {
}

app := fiber.New(fiber.Config{
AppName: "Orakl BootNode API 0.0.1",
AppName: "Miko BootNode API 0.0.1",
EnablePrintRoutes: true,
ErrorHandler: CustomErrorHandler,
})
Expand Down
34 changes: 17 additions & 17 deletions node/pkg/checker/balance/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,18 @@ func loadEnvs() {
}

func getUrls() (Urls, error) {
oraklApiUrl := os.Getenv("ORAKL_API_URL")
if oraklApiUrl == "" {
mikoApiUrl := os.Getenv("ORAKL_API_URL")
if mikoApiUrl == "" {
return Urls{}, errors.New("ORAKL_API_URL not found")
}

oraklNodeAdminUrl := os.Getenv("ORAKL_NODE_ADMIN_URL")
if oraklNodeAdminUrl == "" {
mikoNodeAdminUrl := os.Getenv("ORAKL_NODE_ADMIN_URL")
if mikoNodeAdminUrl == "" {
return Urls{}, errors.New("ORAKL_NODE_ADMIN_URL not found")
}

oraklDelegatorUrl := os.Getenv("ORAKL_DELEGATOR_URL")
if oraklDelegatorUrl == "" {
mikoDelegatorUrl := os.Getenv("ORAKL_DELEGATOR_URL")
if mikoDelegatorUrl == "" {
return Urls{}, errors.New("ORAKL_DELEGATOR_URL not found")
}

Expand All @@ -142,18 +142,18 @@ func getUrls() (Urls, error) {
}

return Urls{
JsonRpcUrl: jsonRpcUrl,
OraklApiUrl: oraklApiUrl,
OraklNodeAdminUrl: oraklNodeAdminUrl,
OraklDelegatorUrl: oraklDelegatorUrl,
PorUrl: porUrl,
JsonRpcUrl: jsonRpcUrl,
MikoApiUrl: mikoApiUrl,
MikoNodeAdminUrl: mikoNodeAdminUrl,
MikoDelegatorUrl: mikoDelegatorUrl,
PorUrl: porUrl,
}, nil
}

func loadWallets(ctx context.Context, urls Urls) ([]Wallet, error) {
result := []Wallet{}

apiWallets, err := loadWalletFromOraklApi(ctx, urls.OraklApiUrl)
apiWallets, err := loadWalletFromMikoApi(ctx, urls.MikoApiUrl)
if err != nil {
return result, err
}
Expand All @@ -165,7 +165,7 @@ func loadWallets(ctx context.Context, urls Urls) ([]Wallet, error) {
}
result = append(result, porWallet)

delegatorWallet, err := loadWalletFromDelegator(ctx, urls.OraklDelegatorUrl)
delegatorWallet, err := loadWalletFromDelegator(ctx, urls.MikoDelegatorUrl)
if err != nil {
return result, err
}
Expand All @@ -174,14 +174,14 @@ func loadWallets(ctx context.Context, urls Urls) ([]Wallet, error) {
return result, nil
}

func loadWalletFromOraklApi(ctx context.Context, url string) ([]Wallet, error) {
func loadWalletFromMikoApi(ctx context.Context, url string) ([]Wallet, error) {
type ReporterModel struct {
Address string `json:"address"`
Service string `json:"service"`
}

result := []Wallet{}
reporters, err := request.Request[[]ReporterModel](request.WithEndpoint(url+oraklApiEndpoint), request.WithTimeout(30*time.Second))
reporters, err := request.Request[[]ReporterModel](request.WithEndpoint(url+mikoApiEndpoint), request.WithTimeout(30*time.Second))
if err != nil {
return result, err
}
Expand All @@ -201,7 +201,7 @@ func loadWalletFromOraklApi(ctx context.Context, url string) ([]Wallet, error) {
Address: address,
Balance: 0,
Minimum: minimumBalance,
Tag: "reporter loaded from orakl api",
Tag: "reporter loaded from miko api",

BalanceHistory: []BalanceHistoryEntry{},
}
Expand Down Expand Up @@ -245,7 +245,7 @@ func loadWalletFromPor(ctx context.Context, url string) (Wallet, error) {

func loadWalletFromDelegator(ctx context.Context, url string) (Wallet, error) {
wallet := Wallet{}
feePayer, err := request.Request[string](request.WithEndpoint(url + oraklDelegatorEndpoint))
feePayer, err := request.Request[string](request.WithEndpoint(url + mikoDelegatorEndpoint))
if err != nil {
return wallet, err
}
Expand Down
4 changes: 2 additions & 2 deletions node/pkg/checker/balance/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ const (
testAddressWithFixedKlay = "0x2138824ef8741add09E8680F968e1d5D0AC155E0"
)

func TestLoadWalletFromOraklApi(t *testing.T) {
func TestLoadWalletFromMikoApi(t *testing.T) {
ctx := context.Background()
mockServer := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
rw.Write([]byte(`[{"pk":"abc", "address":"` + testAddr0 + `", "service":"REQUEST_RESPONSE"},{"pk":"def", "address":"` + testAddr1 + `", "service":"VRF"}]`))
}))
defer mockServer.Close()

wallets, err := loadWalletFromOraklApi(ctx, mockServer.URL)
wallets, err := loadWalletFromMikoApi(ctx, mockServer.URL)
if err != nil {
t.Fatalf("Expected no error, got %v", err)
}
Expand Down
14 changes: 7 additions & 7 deletions node/pkg/checker/balance/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
)

const (
oraklApiEndpoint = "/reporter"
oraklDelegatorEndpoint = "/sign/feePayer"
mikoApiEndpoint = "/reporter"
mikoDelegatorEndpoint = "/sign/feePayer"
porEndpoint = "/address"
DefaultRRMinimum = 1
BalanceHistoryTTL = 60 * time.Minute
Expand All @@ -26,11 +26,11 @@ var klaytnClient *client.Client
var wallets []Wallet

type Urls struct {
JsonRpcUrl string
OraklApiUrl string
OraklNodeAdminUrl string
OraklDelegatorUrl string
PorUrl string
JsonRpcUrl string
MikoApiUrl string
MikoNodeAdminUrl string
MikoDelegatorUrl string
PorUrl string
}

type Wallet struct {
Expand Down
2 changes: 1 addition & 1 deletion node/pkg/checker/event/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func timeSinceLastPorEvent(ctx context.Context, feed FeedToCheck) (time.Duration

func loadExpectedEventIntervals() ([]Config, error) {
chain := os.Getenv("CHAIN")
url := loadOraklConfigUrl(chain)
url := loadMikoConfigUrl(chain)
return request.Request[[]Config](request.WithEndpoint(url))
}

Expand Down
2 changes: 1 addition & 1 deletion node/pkg/checker/event/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func loadUnfullfilledVRFEventQuery(schemaName string, eventName string) string {
return fmt.Sprintf(`SELECT block$, id, time FROM %s.%s WHERE success = false ORDER BY time DESC;`, schemaName, eventName)
}

func loadOraklConfigUrl(chain string) string {
func loadMikoConfigUrl(chain string) string {
return fmt.Sprintf("https://config.orakl.network/%s_configs.json", chain)
}

Expand Down
8 changes: 4 additions & 4 deletions node/pkg/checker/peers/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func Start() error {
log.Error().Err(err).Msg("Failed to check peer count")
failCount++
if failCount > 10 {
alert.SlackAlert(fmt.Sprintf("failed to check peer count %d times. Check orakl Sentinel logs", failCount))
alert.SlackAlert(fmt.Sprintf("failed to check peer count %d times. Check miko Sentinel logs", failCount))
failCount = 0
}
continue
Expand All @@ -75,12 +75,12 @@ func Start() error {
}

func checkPeerCounts() (int, error) {
oraklNodeAdminUrl := os.Getenv("ORAKL_NODE_ADMIN_URL")
if oraklNodeAdminUrl == "" {
mikoNodeAdminUrl := os.Getenv("ORAKL_NODE_ADMIN_URL")
if mikoNodeAdminUrl == "" {
return 0, errors.New("ORAKL_NODE_ADMIN_URL not found")
}

resp, err := request.Request[peerCountResponse](request.WithEndpoint(oraklNodeAdminUrl+peerCountEndpoint), request.WithTimeout(10*time.Second))
resp, err := request.Request[peerCountResponse](request.WithEndpoint(mikoNodeAdminUrl+peerCountEndpoint), request.WithTimeout(10*time.Second))
if err != nil {
return 0, err
}
Expand Down
2 changes: 1 addition & 1 deletion node/pkg/dal/apiv2/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (s *ServerV2) WSHandler(w http.ResponseWriter, r *http.Request) {

func (s *ServerV2) HealthCheckHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
_, err := w.Write([]byte("Orakl Node DAL API"))
_, err := w.Write([]byte("Miko Node DAL API"))
if err != nil {
log.Error().Err(err).Msg("failed to write response")
}
Expand Down
2 changes: 1 addition & 1 deletion node/pkg/por/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (a *App) Run(ctx context.Context) error {

http.HandleFunc("/api/v1", func(w http.ResponseWriter, r *http.Request) {
// Respond with a simple string
_, err := w.Write([]byte("Orakl POR"))
_, err := w.Write([]byte("Miko POR"))
if err != nil {
log.Error().Err(err).Msg("failed to write response")
}
Expand Down