-
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
[TECHDEBT] Consolidate & encapsulate ValidatorMap logic - (Issue #203) #402
Conversation
…stence-addrbook-management_l
…ration-with-utility-for-addrbook-lookups
…et into issue/203-validatorMap
Co-authored-by: Daniel Olshansky <[email protected]>
Co-authored-by: Daniel Olshansky <[email protected]>
Co-authored-by: Daniel Olshansky <[email protected]>
Co-authored-by: Daniel Olshansky <[email protected]>
…et into issue/203-validatorMap
Co-authored-by: Daniel Olshansky <[email protected]>
@Olshansk all yours again buddy 🎾 😀 |
@@ -130,7 +130,7 @@ rebuild_client_start: docker_check ## Rebuild and run a client daemon which is o | |||
|
|||
.PHONY: client_connect | |||
client_connect: docker_check ## Connect to the running client debugging daemon | |||
docker exec -it client /bin/bash -c "go run -tags=debug app/client/*.go debug" | |||
docker exec -it client /bin/bash -c "POCKET_P2P_IS_CLIENT_ONLY=true go run -tags=debug app/client/*.go debug" |
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.
Otherwise I can put it at the root of the config and be POCKET_CLIENT_DEBUG_MODE (probably better if we think it can be useful for other purposes, I can't think about anything else currently
Let's do this
m.network = stdnetwork.NewNetwork(m.GetBus(), m.p2pCfg, addrbookProvider, currentHeightProvider) | ||
} | ||
|
||
if m.p2pCfg.GetIsClientOnly() { |
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.
Inside of p2p/raintree/network.go
we check bus == nil
, whereas here we check if the cfg is client only.
I'm beginning to fear a bit that the lack of a bus (or even a debug bus) is adding lots of checks just because we are logging telemetry.
Do you see a better approach (in this PR or followup) to simplify it?
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.
Fair point that I had kinda already addressed in #425 but now with this nudge I have improved further:
bd85dd4
Basically now we fallback to a noopTelemetry module in there and also we always have a bus.
Therefore the check is not needed anymore.
Also, you made me think harder about the debugclient flag and the fact that I was using an environment variable to override it. Nonsense, inside the CLI we know we are initializing a debug client 🤦♂️ so I have added the proper configuration option.
p2p/providers/addrbook_provider/persistence/addrbook_provider.go
Outdated
Show resolved
Hide resolved
p2p/providers/current_height_provider/debug/debug_current_height_provider.go
Outdated
Show resolved
Hide resolved
Co-authored-by: Daniel Olshansky <[email protected]>
Co-authored-by: Daniel Olshansky <[email protected]>
…et into issue/203-validatorMap
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.
…t - (Issue #331) (#425) ## Description This PR builds upon #402 and removes `validatorMap` from the `consensusModule` struct, encapsulating the logic so that the validator set is dynamic and retrieved from the `persistence` module. Also, since the change introduced the natural dependency on `persistence`, it made me question and revisit the way the modules register themselves with the `bus` and also how the modules are instantiated. In an effort to simply the codebase and testing, while we improve the way we do dependency injection, the modules now are instantiated with a `bus` that will allow them to access to all the dependencies they need. Previously the modules required a `runtimeMgr` in their constructor and the bus registration was handled like an after-thought. ## Issue Fixes #331 ## Type of change Please mark the relevant option(s): - [x] New feature, functionality or library - [ ] Bug fix - [x] Code health or cleanup - [x] Major breaking change - [ ] Documentation - [ ] Other <!-- add details here if it a different type of change --> ## List of changes - Removed `validatorMap` from `consensusModule` and encapsulated the logic so that it's dynamic, per-height and sourced from `persistence` - Refactored module registration in `bus` - Refactored modules instantiation and DI (`runtimeMgr` -> `bus`) - The `runtimeMgr` is now a dependency and it can be accessed via the bus - Minor improvements in tests ## 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` ## 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 tested my changes using the available tooling - [ ] I have updated the corresponding CHANGELOG ### If Applicable Checklist - [x] 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) Signed-off-by: Alessandro De Blasis <[email protected]> Co-authored-by: Daniel Olshansky <[email protected]>
Description
Issue
Fixes #203
Type of change
Please mark the relevant option(s):
List of changes
modules.ValidatorMap
are removed/internalized withinConsensus
LocalNet
Testing
make develop_test
README
Required Checklist
If Applicable Checklist
shared/docs/*
if I updatedshared/*
README(s)