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

Log out important directories for validator client #5653

Merged
merged 18 commits into from
Apr 30, 2020
Merged

Log out important directories for validator client #5653

merged 18 commits into from
Apr 30, 2020

Conversation

ShawkiS
Copy link
Contributor

@ShawkiS ShawkiS commented Apr 27, 2020

Resolves #5617

Description
Write why you are making the changes in this pull request

I want to print the .db and validator keys location at the beginning of the process.

Write a summary of the changes you are making:
-Logging the DB path in validator client in NewValidatorClient in validator/node/node.go
-Logging the Keystore path in validator client in NewKeystore function in validator/keymanager/direct_keystore.go

@ShawkiS ShawkiS requested a review from a team as a code owner April 27, 2020 20:09
@ShawkiS ShawkiS requested review from farazdagi, 0xKiwi and nisdas April 27, 2020 20:09
Copy link
Member

@terencechain terencechain left a comment

Choose a reason for hiding this comment

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

We do log this today for beacon node

[2020-04-27 13:04:49]  INFO node: Checking DB database-path=/Users/terencetsao/Library/Eth2/beaconchaindata

@codecov
Copy link

codecov bot commented Apr 27, 2020

Codecov Report

Merging #5653 into master will decrease coverage by 21.17%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #5653       +/-   ##
==========================================
- Coverage   26.80%   5.62%   -21.18%     
==========================================
  Files         241     116      -125     
  Lines       21193    9328    -11865     
==========================================
- Hits         5681     525     -5156     
+ Misses      14423    8702     -5721     
+ Partials     1089     101      -988     

@ShawkiS ShawkiS requested a review from terencechain April 27, 2020 22:24
@@ -76,6 +77,7 @@ func NewKVStore(dirPath string, cfg *Config) (*Store, error) {
if err := os.MkdirAll(dirPath, 0700); err != nil {
return nil, err
}
logrus.Infof(".db & validator keys dir is: %v", dirPath)
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't needed, the slasher already logs out the datadir.

@@ -68,6 +68,7 @@ func NewKVStore(dirPath string, pubKeys [][48]byte) (*Store, error) {
if err := os.MkdirAll(dirPath, 0700); err != nil {
return nil, err
}
log.Infof(".db & validator keys dir is: %v", dirPath)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not correct, the validator keys are not in this directory. You will need another log to declare where they are. Look at how the Checking DB log is put out and mirror that for this one.

@ShawkiS ShawkiS changed the title Display key paths at startup Log out important directories for validator client Apr 27, 2020
@@ -68,6 +69,8 @@ func NewKVStore(dirPath string, pubKeys [][48]byte) (*Store, error) {
if err := os.MkdirAll(dirPath, 0700); err != nil {
return nil, err
}
log.WithField("database-path", dirPath).Info("Checking DB")
log.WithField("validator-keys-path", cmd.DataDirFlag.Name).Info("Checking Validator Keys")
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't this print validator-keys-path=datadir?

Copy link
Member

Choose a reason for hiding this comment

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

By this i mean, you are printing the flag name, not the value of the flag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh sorry, What is the property I have to use to get the datadir?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @ShawkiS typically we can use something like cliCtx.GlobalString(cmd.DataDirFlag.Name)

@@ -101,6 +101,7 @@ func NewValidatorClient(ctx *cli.Context) (*ValidatorClient, error) {
if err := clearDB(dataDir, pubkeys, forceClearFlag); err != nil {
return nil, err
}
log.WithField("database-path and validator-keys-path", dataDir).Info("Checking DB and Validator Keys")
Copy link
Contributor

@rauljordan rauljordan Apr 28, 2020

Choose a reason for hiding this comment

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

Suggested change
log.WithField("database-path and validator-keys-path", dataDir).Info("Checking DB and Validator Keys")
log.WithField("path", dataDir).Info("Checking DB and validator keystore path")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, thank you. I changed it.

@ShawkiS ShawkiS requested a review from 0xKiwi April 28, 2020 19:29
@@ -101,6 +101,7 @@ func NewValidatorClient(ctx *cli.Context) (*ValidatorClient, error) {
if err := clearDB(dataDir, pubkeys, forceClearFlag); err != nil {
return nil, err
}
log.WithField("path", dataDir).Info("Checking DB path")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you mirror this to the beacon node log? So Checking DB and the field name databasePath.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, done

@@ -45,6 +45,7 @@ func NewKeystore(input string) (KeyManager, string, error) {
if opts.Path == "" {
opts.Path = accounts.DefaultValidatorDir()
}
log.WithField("path", opts.Path).Info("Checking validator keystore path")
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, can you change the text to "Checking validator keys" and the field to "keystorePath"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, done

Copy link
Contributor

@0xKiwi 0xKiwi left a comment

Choose a reason for hiding this comment

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

Meant to just comment, my bad

@ShawkiS ShawkiS requested review from 0xKiwi and rauljordan April 28, 2020 20:57
prestonvanloon
prestonvanloon previously approved these changes Apr 28, 2020
Copy link
Member

@terencechain terencechain left a comment

Choose a reason for hiding this comment

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

I don't understand this. Validator client only logs the DB directory path if clear-db is applied? I don't think this is intension given the description. Can you also update the description please?

Screen Shot 2020-04-28 at 4 40 47 PM

@prylabs-bulldozer prylabs-bulldozer bot merged commit e1ac1d3 into prysmaticlabs:master Apr 30, 2020
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.

Request: Display beaconchain.db and validator key paths at startup
5 participants