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

feat: pass master key as an option #690

Closed

Conversation

darrenvechain
Copy link
Member

Description

This change allows injection of a master key as a startup flag

Fixes # (issue)

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

./bin/thor --network main --master-key eb5cce9a3ba17cd90fd4238cb382d1c47f1c2084f71384f6de6da03a1582d5e6

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • New and existing E2E tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have not added any vulnerable dependencies to my code

@darrenvechain darrenvechain requested a review from a team as a code owner April 3, 2024 13:41
@darrenvechain darrenvechain marked this pull request as draft April 3, 2024 13:42
@codecov-commenter
Copy link

codecov-commenter commented Apr 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.27%. Comparing base (c9c4a51) to head (d640297).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #690   +/-   ##
=======================================
  Coverage   57.27%   57.27%           
=======================================
  Files         156      156           
  Lines       17218    17218           
=======================================
  Hits         9862     9862           
  Misses       6392     6392           
  Partials      964      964           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kgapos
Copy link
Member

kgapos commented Apr 3, 2024

@darrenvechain looks good, you may want to document it in the docs?

@darrenvechain
Copy link
Member Author

@darrenvechain looks good, you may want to document it in the docs?

Yepp, done here: cea3ec6

otherview
otherview previously approved these changes Apr 3, 2024
Copy link
Member

@otherview otherview left a comment

Choose a reason for hiding this comment

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

lgtm - optional nit, non-blocking imo

@@ -395,6 +395,20 @@ func masterKeyPath(ctx *cli.Context) (string, error) {
}

func loadNodeMaster(ctx *cli.Context) (*node.Master, error) {

masterKey := ctx.String(masterKeyFlag.Name)
if masterKey != "" {
Copy link
Member

Choose a reason for hiding this comment

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

Looks good! A small nit to avoid code repetition sugestion would be a small refactor. I think perhaps something like:

  1. key is set by flag
  2. otherwise key is set by path
    3 if key is set then test beneficiary and return masterkey

Copy link
Member Author

Choose a reason for hiding this comment

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

@otherview I made a commit to refactor this

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.

4 participants