-
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] [P2P] integration with persistence for addressBook management - (Issue #271) #374
[TECHDEBT] [P2P] integration with persistence for addressBook management - (Issue #271) #374
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.
@deblasis Left a few comments, and the integration of consensus with persistence is great, but I think I may have led you down the wrong path.
-
When we're doing something like consensus, the proposer does a direct send (address forwarded to P2P and P2P resolves it).
-
When we're doing a structured gossip (where every staked actor has the same view of all the addresses on the network), the P2P module retrieves that list from persistence, and is then responsible for resolving addresses to IPs. When an address doesn't resolve is when we need to start looking at our redundancy/cleanup/adjust/resent layers
-
This is making me think that in the case of full nodes, there might also be a a need for random gossip (increase data availability, but still need to mull on it).
Overall, given the comments, do you see a need for the broadcast events introduced here?
p2p/module.go
Outdated
return fmt.Errorf("failed to cast message to BeforeHeightChangedEvent") | ||
} | ||
|
||
// DISCUSS (https://github.com/pokt-network/pocket/pull/374#issuecomment-1341350786): decide if we want a pull or push model for integrating with persistence |
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.
To quote you previous message:
Where would this function be called currently? I would say that if it's not relevant to the scope of this issue we shouldn't do it here. Sounds like scope creep a little bit. No?
I'm personally not a huge fan because these events were out of scope and are not being used, though I can see where your head is at.
If I were to introduce a new event, I'd probably create a NewViewEvent(height, round)
and/or NewHeight(height)
because I can only speculate how we'd use BeforeNewHeightEvent
right now and the cost to add it is low.
I don't want this to continue being a blocker, but not a fan. Let's do this:
- If you feel strongly that
BeforeNewHeightEvent
andHeightChangedEvent
events will be useful, let's keep it as is. - If you're not sure, let's do one of the following:
2.1. Remove them altogether
2.2 Just add aNewViewEvent
(per my suggestions)
persistence/genesis.go
Outdated
|
||
// IMPROVE: This is a proof of concept. Ideally we should have a single query that returns all actors. | ||
func (p PostgresContext) GetAllStakedActors(height int64) (actors []modules.Actor, err error) { | ||
actors = make([]modules.Actor, 0) |
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.
if we don't initialize this, does it break?
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 Sorry for hom many back & forths this one is taking, but it's looking better with every iteration, and thank you for bearing! |
It's all good @Olshansk ! It's all part of the process. I should be the one apologizing if you think about it. I'll address your comments and re-request review later today. 🙏 |
Co-authored-by: Daniel Olshansky <olshansky@pokt.network>
…stence-addrbook-management_l Signed-off-by: Alessandro De Blasis <alex@deblasis.net>
to DefaultP2PMempoolMaxNonceCount
I have removed the events, addressed comments and it's ready for another pass. Fewer things to look at I guess. We are getting there. When you are happy I'll update the |
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.
LGTM, let's just update the CHANGELOG and we're good to go
Co-authored-by: Daniel Olshansky <olshansky@pokt.network>
@Olshansk CHANGELOGs updated |
runtime/docs/CHANGELOG.md
Outdated
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
|
|||
## [Unreleased] | |||
|
|||
## [0.0.1] - 2022-12-14 | |||
|
|||
- Added `DefaultP2PMempoolMaxNonceCount` |
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.
Optional: Rename this to DefaultP2PMempoolMaxCount
instead DefaultP2PMempoolMaxNonceCount
to match the interface 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.
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.
… - (Issue #270) (#378) ## Description This PR builds on top of #374 (the base branch is not `main` in order to highlight the delta of the changes) in order to tend to the TECHDEBT TODOs listed in #270 ## Issue Fixes #270 ## Type of change Please mark the relevant option(s): - [x] New feature, functionality or library - [ ] Bug fix - [x] Code health or cleanup - [ ] Major breaking change - [ ] Documentation - [ ] Other <!-- add details here if it a different type of change --> ## List of changes - Consensus - `LeaderElectionModule`'s `electNextLeaderDeterministicRoundRobin` now uses `Persistence` to access the list of validators instead of the static `ValidatorMap`. - Updated tests (mock configs) accounting for the updated logic - P2P - `ValidatorMapToAddrBook` renamed to `ActorToAddrBook` - `ValidatorToNetworkPeer` renamed to `ActorToNetworkPeer` ## 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` <!-- 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 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 - [ ] 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 <alex@deblasis.net> Co-authored-by: Daniel Olshansky <olshansky@pokt.network>
… - (Issue #270) (#378) This PR builds on top of #374 (the base branch is not `main` in order to highlight the delta of the changes) in order to tend to the TECHDEBT TODOs listed in #270 Fixes #270 Please mark the relevant option(s): - [x] New feature, functionality or library - [ ] Bug fix - [x] Code health or cleanup - [ ] Major breaking change - [ ] Documentation - [ ] Other <!-- add details here if it a different type of change --> - Consensus - `LeaderElectionModule`'s `electNextLeaderDeterministicRoundRobin` now uses `Persistence` to access the list of validators instead of the static `ValidatorMap`. - Updated tests (mock configs) accounting for the updated logic - P2P - `ValidatorMapToAddrBook` renamed to `ActorToAddrBook` - `ValidatorToNetworkPeer` renamed to `ActorToNetworkPeer` - [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` <!-- If you added additional tests or infrastructure, describe it here. Bonus points for images and videos or gifs. --> - [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 - [x] I have updated the corresponding CHANGELOG - [ ] I have updated the corresponding README(s); local and/or global - [ ] 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 <alex@deblasis.net> Co-authored-by: Daniel Olshansky <olshansky@pokt.network>
Description
This PR is a stepping stone for the removal of the
ValidatorMap
.Specifically it allows us to use per-Height addressBook and lays the ground for churn management.
Right before a new height is reached, the addressBook is propagated via a message on the
Bus
so that other interested modules can handle it. This part is out-of-scope for this PR and will be covered later on in a specific issue, unless differently agreed during code-review.Also, this PR tends to the TODO:
pocket/p2p/raintree/network.go
Line 29 in 444c424
Issue
Fixes #271
Type of change
Please mark the relevant option(s):
List of changes
numValidators
make test_consensus_concurrent_tests
so that we can run the correct test matrixGetBus()
instead ofbus
wherever possibleaddrbookProvider
that abstracts the fetching and the mapping fromActor
toNetworkPeer
addrBook
to the debug client (will be removed in an upcoming PR already in the works for issues #203 and #331)transport
packageaddrBook
from theaddrbookProvider
and thereforePersistence
Olshansk marked this conversation as resolved.
Show resolved
peersManager
with it.genesis.go
toactor.go
GetAllStakedActors()
that returns all ActorsGetMaxMempoolCount
Testing
make develop_test
README
Required Checklist
If Applicable Checklist
shared/docs/*
if I updatedshared/*
README(s)