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

[Fix] Patch minor #22

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

[Fix] Patch minor #22

wants to merge 7 commits into from

Conversation

nkitlabs
Copy link
Collaborator

Fixed:

  • command description.
  • Fix function names.
  • Refactor tunnel relayer and initialization process.
  • Remove key private_key from chain configuration.

Implementation details

Please ensure the following requirements are met before submitting a pull request:

  • The pull request is targeted against the correct target branch
  • The pull request is linked to an issue with appropriate discussion and an accepted design OR is linked to a spec that describes the work.
  • The pull request includes a description of the implementation/work done in detail.
  • The pull request includes any and all appropriate unit/integration tests
  • You have added a relevant changelog entry to CHANGELOG_UNRELEASED.md
  • You have re-reviewed the files affected by the pull request (e.g. using the Files changed tab in the Github PR explorer)

@nkitlabs nkitlabs requested review from RogerKSI and tanut32039 and removed request for RogerKSI December 17, 2024 02:46
// 3. log-level from configuration object.
// 4. given log level from the input.
logLevel := configLogLevel
logLevelViper := a.Viper.GetString("log-level")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason why we choose to send viper in instead of handling value from cmd?

Comment on lines +167 to +172

// check if file doesn't exist, exit the function as the config may not be initialized.
if _, err := os.Stat(cfgPath); os.IsNotExist(err) {
return nil
} else if err != nil {
return err

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a bit weird to return no-error if the config file doesn't exist? caller will need to check from the variable only to see if it can load successfully.

@@ -211,13 +221,17 @@ func (a *App) InitConfigFile(homePath string, customFilePath string) error {
if err = os.Mkdir(homePath, os.ModePerm); err != nil {
return err
}
} else if err != nil {
return err
}

// Create the config folder if doesn't exist
if _, err := os.Stat(cfgDir); os.IsNotExist(err) {
if err = os.Mkdir(cfgDir, os.ModePerm); err != nil {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be err := instead?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, maybe we can create helper function to create folder if it doesn't exist.

Comment on lines 577 to 580
if len(tunnels) == 0 {
a.Log.Error("No tunnel ID provided")
return fmt.Errorf("no tunnel ID provided")
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it also can happen when run with just start command but there's no tunnel on chain?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for that case, we should not return error.

@@ -99,7 +98,7 @@ func (c *client) Connect(timeout uint) error {
return nil
}

return nil
return fmt.Errorf("failed to connect to Band Chain")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BandChain

Comment on lines +73 to +77
// Return if there are no RPC endpoints
if len(c.RpcEndpoints) == 0 {
return nil
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why choose to return nil? no endpoints mean can't connect?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants