-
Notifications
You must be signed in to change notification settings - Fork 33
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
[CLI][Localnet][Bug] - [localnet_client_debug] Error 137 - Issue #607 #608
Conversation
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.
"Missing changelog in module: app/
Missing changelog in module: build/
Changelog verification failed. See error messages for more detail.
"
Please update the relevant CHANGELOG.md files and ensure they follow the correct format.
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.
"Missing changelog in module: app/
Missing changelog in module: build/
Changelog verification failed. See error messages for more detail.
"
Please update the relevant CHANGELOG.md files and ensure they follow the correct format.
@0xBigBoss and @h5law , I am not tagging you guys as reviewers because I don't want to assume that you want to spend time on this at all but if you are curious, I have made some changes to improve the keybase initialization process and I would love your feedback. |
// Add the keys if the keybase contains less than 999 | ||
curAddr, _, err := kb.GetAll() | ||
if err != nil { | ||
if err := restoreBadgerDB(build.DebugKeybaseBackup, db); err != nil { |
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.
This logic is much cleaner 10/10 🚀
build/debug_keybase/main.go
Outdated
hashString := fmt.Sprintf("%x.md5", sourceYamlHash) | ||
hashFilePath := filepath.Join(targetFolderPath, hashString) | ||
targetFilePath := filepath.Join(targetFolderPath, "debug_keybase.bak") | ||
_, err = os.Stat(hashFilePath) |
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.
Not completely necissary but we have the function FileExists
in shared/utils/file_utils.go
// Check file at the given path exists
func FileExists(path string) (bool, error) {
_, err := os.Stat(path)
if err == nil {
return true, nil
}
if errors.Is(err, fs.ErrNotExist) {
return false, nil
}
return false, err
}
If you don't decide to change to use this see the comment below
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.
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.
@deblasis This is great. I was concerned about the time it took to load the keys even with the use of WriteBatch
this is such a great improvement. I left two minor comments but overall everything looks great as usual with your work!
PS. Love the emojis in the print lines 👀
Co-authored-by: harry <[email protected]>
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.
"Missing changelog in module: app/
Missing changelog in module: build/
Changelog verification failed. See error messages for more detail.
"
Please update the relevant CHANGELOG.md files and ensure they follow the correct format.
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.
"Missing changelog in module: app/
Missing changelog in module: build/
Changelog verification failed. See error messages for more detail.
"
Please update the relevant CHANGELOG.md files and ensure they follow the correct format.
You are too kind, sir, thank you very much. I have applied your suggestions 🙏 |
Oh, that long re-hydration is annoying, I agree. In previous pr @0xBigBoss suggested to reuse the volume with already imported keys which would require to import keys only once. Still, your change makes it even better! How do you feel about committing a binary file into the repo? I usually try to avoid this but in that case I can't think of a better way to handle this and avoid storing a binary in git. |
The check succeeded, dismissing the review comment.
Mounting a volume also works I guess. Code can always be changed/improved. I needed a solution fast and this was the fastest thing I could come up with.
Fair point, I thought about it, but personally, I think it's a trade-off worth making considering the improved DevX. Of course, I might be wrong. |
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.
🙌
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.
"Latest date in app/docs/CHANGELOG.md is incorrect.
Latest: 2023-03-23, Current: 2023-03-24
Latest date in build/docs/CHANGELOG.md is incorrect.
Latest: 2023-03-23, Current: 2023-03-24
Latest date in libp2p/docs/CHANGELOG.md is incorrect.
Latest: 2023-03-23, Current: 2023-03-24
Changelog verification failed. See error messages for more detail.
"
Please update the relevant CHANGELOG.md files and ensure they follow the correct format.
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.
"Latest date in libp2p/docs/CHANGELOG.md is incorrect.
Latest: 2023-03-23, Current: 2023-03-24
Changelog verification failed. See error messages for more detail.
"
Please update the relevant CHANGELOG.md files and ensure they follow the correct format.
The check succeeded, dismissing the review comment.
@Olshansk I didn't merge it because of this #608 (comment) Please let me know your thoughts about that. |
…p-modules * pokt/main: [Utility][Persistence][Savepoints/Rollbacks] Refactor UtilityContext into UtilityUnitOfWork (Issue #563) (#577) [Consensus] Add Quorum Certificate to the block (#593) docs(wiki): ValueError: Duplicate wiki path: devlog/template (#620) Remove unused import [Infra][P2P] Bug: "address not found in peerstore" error in localnet_debug_client when scaling up Localnet - Issue #604 (#611) [CLI][Localnet][Bug] - [localnet_client_debug] Error 137 - Issue #607 (#608) [Documentation] Fix links to RPC module docs in README (#603)
Description
This PR improves the keybase initialization by:
private_keys.yaml
has been changedBefore
At 1:46 I run
make localnet_client_debug
and you can see it takes a long time plus it's a very expensive operationlocalnet_cpu_main.mp4
After
At 1:12 I run
make localnet_client_debug
and it's basically instantaneous with no further spikes in CPU/RAM usagelocalnet_cpu_memoized.mp4
Where is the magic?
We do the expensive operation only when needed and that means when the
private_keys.yaml
has changed.This is handled by a small binary that calculates the hash of the yaml file, compares it with the one we have already (if any) and if needed, it recreates a backup of the keybase that can be rehydrated from the debug client.
Sloppy recording but it shows the whole process:
localnet_cpu_memoization.mp4
Issue
Fixes #607
Type of change
Please mark the relevant option(s):
List of changes
Testing
make develop_test
README
Required Checklist
godoc
format comments on touched members (see: tip.golang.org/doc/comment)If Applicable Checklist
shared/docs/*
if I updatedshared/*
README(s)