-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Recursively Find Validator Database File In Slashing Protection Commands #8518
Recursively Find Validator Database File In Slashing Protection Commands #8518
Conversation
I need some pointers before i proceed to make further changes ExportSlashingProtectionJSONCli /ImportSlashingProtectionJSONCli A util func was added.
|
Codecov Report
@@ Coverage Diff @@
## develop #8518 +/- ##
===========================================
- Coverage 58.15% 58.12% -0.04%
===========================================
Files 459 459
Lines 32918 32905 -13
===========================================
- Hits 19144 19126 -18
- Misses 10872 10883 +11
+ Partials 2902 2896 -6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far!
shared/fileutil/fileutil_test.go
Outdated
require.NoError(t, err) | ||
|
||
assert.DeepEqual(t, tt.found, found) | ||
//assert.DeepEqual(t, tt.path, fpath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok will do.
@ahadda5 we should make the title share more context. Something like: "Recursively Find Validator Database File In Slashing Protection Commands". Additionally, this PR just adds a utility function but does not integrate it where it is needed. Since this PR is quite small, it is OK to do both things in this single PR. Please revise at your own convenience and then we can review again |
Sorry what title are you referring to? code commentary and/or the func name ?
|
unit tested the slashing
However i need to test the actual export/import , how can i make sure the shell script is calling my build (read somewhere that it downloads the latest and greatest build).
|
} | ||
// checks if its a file and has the exact name as the filename | ||
// need to break the walk function by using a non-fatal error | ||
if !info.IsDir() && filename == info.Name() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this the best way to check if its a file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep this is a fine approach
bazel run //validator -- slashing-protection export --datadir=/home/ahaddad/eth2validators --slashing-protection-export-dir=/home/ahaddad |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another great contribution, thanks so much @ahadda5
oops @rauljordan i didn't want you to merge it before i finished the test. Now as expected one has to specify the full path (./ or C:) to make sure it is not read relative otherwise it errors. So with the first resulting in "error finding validator database at path" which is ok albeit added "feature"/warning. Secondly and more importantly, my validator.db is a juicy testnet db of 20 MB yet exporting it does not result in the slashing.json. Hmm.. I'm just afraid this was not tested thoroughly. |
Sorry for merging so quickly @ahadda5, we should open these concerns in your message above as an issue that should be resolved |
What type of PR is this?
Feature
What does this PR do? Why is it needed?
It ensures that the validator.db is found in the specified datadir or its subdirectories before the slashing export commences. Want to avoid going through the process if validator.db is not there.
Which issues(s) does this PR fix?
Fixes #8500