You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Description
This PR improves the keybase initialization by:
- doing the work only if the `private_keys.yaml` has been changed
- creating a backup of the keybase
- loading it (which is way cheaper than parsing the yaml and rehydrating
the keybase from scratch)
### Before
At 1:46 I run `make localnet_client_debug` and you can see it takes a
long time plus it's a very expensive operation
https://user-images.githubusercontent.com/29378614/227202479-1320fdf4-f851-4a58-884e-a36b3c385b84.mp4
### After
At 1:12 I run `make localnet_client_debug` and it's basically
instantaneous with no further spikes in CPU/RAM usage
https://user-images.githubusercontent.com/29378614/227202494-a1eff819-e2d9-4881-a2e5-4b28448d574c.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:
https://user-images.githubusercontent.com/29378614/227204654-7b7f3ea8-6db5-473c-ac6c-75be13f60553.mp4
## Issue
Fixes#607
## Type of change
Please mark the relevant option(s):
- [x] New feature, functionality or library
- [x] Bug fix
- [ ] Code health or cleanup
- [ ] Major breaking change
- [ ] Documentation
- [ ] Other <!-- add details here if it a different type of change -->
## List of changes
- Updated debug keybase initialization
- Created small binary to help with the integrity check
## Testing
- [x] `make develop_test`
- [x]
[LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md)
w/ all of the steps outlined in the `README`
<!-- REMOVE this comment block after following the instructions
If you added additional tests or infrastructure, describe it here.
Bonus points for images and videos or gifs.
-->
## Required Checklist
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have added, or updated, [`godoc` format
comments](https://go.dev/blog/godoc) on touched members (see:
[tip.golang.org/doc/comment](https://tip.golang.org/doc/comment))
- [x] I have tested my changes using the available tooling
- [x] I have updated the corresponding CHANGELOG
### If Applicable Checklist
- [ ] I have updated the corresponding README(s); local and/or global
- [x] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have added, or updated,
[mermaid.js](https://mermaid-js.github.io) diagrams in the corresponding
README(s)
- [ ] I have added, or updated, documentation and
[mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*`
if I updated `shared/*`README(s)
---------
Co-authored-by: harry <[email protected]>
// parseValidatorPrivateKeysFromEmbeddedYaml fetches the validator private keys from the embedded build/localnet/manifests/private-keys.yaml manifest file.
0 commit comments