Skip to content

Commit

Permalink
update cmds to use new registrar gateway instead of substrate
Browse files Browse the repository at this point in the history
  • Loading branch information
Eslam-Nawara committed Jan 28, 2025
1 parent 1efcc58 commit 7b546c8
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions cmds/identityd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
"time"

"github.com/pkg/errors"
"github.com/threefoldtech/zos4/pkg/stubs"
"github.com/threefoldtech/zosbase/pkg/app"
"github.com/threefoldtech/zosbase/pkg/stubs"
"github.com/threefoldtech/zosbase/pkg/upgrade"

"github.com/threefoldtech/zos4/pkg"
"github.com/threefoldtech/zos4/pkg/identity"
"github.com/threefoldtech/zosbase/pkg"
"github.com/threefoldtech/zosbase/pkg/environment"

"github.com/rs/zerolog/log"
Expand Down
2 changes: 1 addition & 1 deletion cmds/modules/api_gateway/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
substrate "github.com/threefoldtech/tfchain/clients/tfchain-client-go"
"github.com/threefoldtech/tfgrid-sdk-go/rmb-sdk-go/peer"
"github.com/threefoldtech/zbus"
"github.com/threefoldtech/zos4/pkg/stubs"
"github.com/threefoldtech/zosbase/pkg/environment"
"github.com/threefoldtech/zosbase/pkg/stubs"
substrategw "github.com/threefoldtech/zosbase/pkg/substrate_gateway"
"github.com/threefoldtech/zosbase/pkg/utils"
zosapi "github.com/threefoldtech/zosbase/pkg/zos_api_light"
Expand Down
4 changes: 2 additions & 2 deletions cmds/modules/netlightd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"github.com/cenkalti/backoff/v3"
"github.com/rs/zerolog/log"
"github.com/threefoldtech/zbus"
"github.com/threefoldtech/zos4/pkg/stubs"
"github.com/threefoldtech/zosbase/pkg/netlight/bootstrap"
"github.com/threefoldtech/zosbase/pkg/stubs"
"github.com/threefoldtech/zosbase/pkg/utils"
)

Expand Down Expand Up @@ -58,7 +58,7 @@ var Module cli.Command = cli.Command{
}

func myceliumSeedFromIdentity(privKey []byte) []byte {
seed := x25519.PrivateKey(x25519.EdPrivateKeyToX25519([]byte(privKey)))
seed := x25519.PrivateKey(x25519.EdPrivateKeyToX25519(privKey))
return seed[:]
}

Expand Down
3 changes: 2 additions & 1 deletion cmds/modules/powerd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/rs/zerolog/log"
substrate "github.com/threefoldtech/tfchain/clients/tfchain-client-go"
"github.com/threefoldtech/zbus"
zos4stub "github.com/threefoldtech/zos4/pkg/stubs"
"github.com/threefoldtech/zosbase/pkg/environment"
"github.com/threefoldtech/zosbase/pkg/events"
"github.com/threefoldtech/zosbase/pkg/power"
Expand Down Expand Up @@ -58,7 +59,7 @@ func action(cli *cli.Context) error {
log.Info().Err(zuiErr).Send()
}

identity := stubs.NewIdentityManagerStub(cl)
identity := zos4stub.NewIdentityManagerStub(cl)
register := stubs.NewRegistrarStub(cl)

nodeID, err := register.NodeID(ctx)
Expand Down
9 changes: 4 additions & 5 deletions cmds/modules/provisiond/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

"github.com/urfave/cli/v2"

zos4stubs "github.com/threefoldtech/zos4/pkg/stubs"
"github.com/threefoldtech/zosbase/pkg/stubs"
"github.com/threefoldtech/zosbase/pkg/utils"

Expand Down Expand Up @@ -81,7 +82,6 @@ var Module cli.Command = cli.Command{
// state
func integrityChecks(ctx context.Context, rootDir string) error {
err := ReportChecks(filepath.Join(rootDir, metricsStorageDB))

if err != nil {
fmt.Fprintln(os.Stderr, err)
}
Expand Down Expand Up @@ -176,12 +176,12 @@ func action(cli *cli.Context) error {
select {}
}

identity := stubs.NewIdentityManagerStub(cl)
identity := zos4stubs.NewIdentityManagerStub(cl)
sk := ed25519.PrivateKey(identity.PrivateKey(ctx))

// the v1 endpoint will be used by all components to register endpoints
// that are specific for that component
//v1 := router.PathPrefix("/api/v1").Subrouter()
// v1 := router.PathPrefix("/api/v1").Subrouter()
// keep track of resource units reserved and amount of workloads provisionned

// to store reservation locally on the node
Expand Down Expand Up @@ -313,7 +313,7 @@ func action(cli *cli.Context) error {
zos.PublicIPv4Type,
zos.PublicIPType,
zos.ZMachineLightType,
zos.ZLogsType, //make sure zlogs comes after zmachine
zos.ZLogsType, // make sure zlogs comes after zmachine
),
// if this is a node reboot, the node needs to
// recreate all reservations. so we set rerun = true
Expand All @@ -323,7 +323,6 @@ func action(cli *cli.Context) error {
// capacity on chain.
provision.WithCallback(setter.Callback),
)

if err != nil {
return errors.Wrap(err, "failed to instantiate provision engine")
}
Expand Down
3 changes: 2 additions & 1 deletion cmds/modules/provisiond/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/rs/zerolog/log"
substrate "github.com/threefoldtech/tfchain/clients/tfchain-client-go"
"github.com/threefoldtech/zbus"
zos4stubs "github.com/threefoldtech/zos4/pkg/stubs"
"github.com/threefoldtech/zosbase/pkg"
gridtypes "github.com/threefoldtech/zosbase/pkg/gridtypes"
"github.com/threefoldtech/zosbase/pkg/rrd"
Expand Down Expand Up @@ -57,7 +58,7 @@ func ReportChecks(metricsPath string) error {

// NewReporter creates a new capacity reporter
func NewReporter(metricsPath string, cl zbus.Client, root string) (*Reporter, error) {
idMgr := stubs.NewIdentityManagerStub(cl)
idMgr := zos4stubs.NewIdentityManagerStub(cl)
sk := ed25519.PrivateKey(idMgr.PrivateKey(context.TODO()))
id, err := substrate.NewIdentityFromEd25519Key(sk)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion cmds/modules/zui/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/gizak/termui/v3/widgets"
"github.com/threefoldtech/zbus"

zos4stubs "github.com/threefoldtech/zos4/pkg/stubs"
"github.com/threefoldtech/zosbase/pkg/stubs"
)

Expand Down Expand Up @@ -161,6 +162,6 @@ func getNodedStatus(ctx context.Context, client zbus.Client) {
}

func getPowerdStatus(ctx context.Context, client zbus.Client) {
powerd := stubs.NewIdentityManagerStub(client)
powerd := zos4stubs.NewIdentityManagerStub(client)
powerd.NodeID(ctx)
}

0 comments on commit 7b546c8

Please sign in to comment.