From 88b2724338064ce45d9af003af0058be637ab5bb Mon Sep 17 00:00:00 2001 From: artemijspavlovs <19916123+artemijspavlovs@users.noreply.github.com> Date: Thu, 10 Oct 2024 16:35:31 +0700 Subject: [PATCH] fix: mock da backend initialization --- cmd/rollapp/init/utils.go | 6 ++++-- data_layer/celestia/lightclient/lightclient.go | 10 +++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cmd/rollapp/init/utils.go b/cmd/rollapp/init/utils.go index ba4bcb49..f4ae03a0 100644 --- a/cmd/rollapp/init/utils.go +++ b/cmd/rollapp/init/utils.go @@ -5,13 +5,13 @@ import ( "path/filepath" "strings" - "github.com/dymensionxyz/roller/utils/config/tomlconfig" "github.com/pterm/pterm" "github.com/spf13/cobra" initconfig "github.com/dymensionxyz/roller/cmd/config/init" "github.com/dymensionxyz/roller/cmd/consts" celestialightclient "github.com/dymensionxyz/roller/data_layer/celestia/lightclient" + "github.com/dymensionxyz/roller/utils/config/tomlconfig" "github.com/dymensionxyz/roller/utils/errorhandling" "github.com/dymensionxyz/roller/utils/filesystem" genesisutils "github.com/dymensionxyz/roller/utils/genesis" @@ -202,7 +202,9 @@ func runInit( return err } - addresses = append(addresses, *daKeyInfo) + if daKeyInfo != nil { + addresses = append(addresses, *daKeyInfo) + } /* ------------------------------ Print output ------------------------------ */ diff --git a/data_layer/celestia/lightclient/lightclient.go b/data_layer/celestia/lightclient/lightclient.go index 1e2dbeeb..24cb21ac 100644 --- a/data_layer/celestia/lightclient/lightclient.go +++ b/data_layer/celestia/lightclient/lightclient.go @@ -1,7 +1,6 @@ package lightclient import ( - "errors" "os" "os/exec" "path/filepath" @@ -127,7 +126,12 @@ func Initialize(env string, rollerData roller.RollappConfig) (*keys.KeyInfo, err return nil, err } - pterm.Info.Printf("the first %s state update has DA height of %s with hash %s\n", rollerData.RollappID, height, hash) + pterm.Info.Printf( + "the first %s state update has DA height of %s with hash %s\n", + rollerData.RollappID, + height, + hash, + ) pterm.Info.Printf("updating %s \n", celestiaConfigFilePath) err = UpdateConfig(celestiaConfigFilePath, hash, heightInt) if err != nil { @@ -153,7 +157,7 @@ func Initialize(env string, rollerData roller.RollappConfig) (*keys.KeyInfo, err } } - return nil, errors.New("failed to initialize da client") + return nil, nil } func UpdateConfig(file, hash string, height int) error {