-
Notifications
You must be signed in to change notification settings - Fork 0
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
Leanpocket V0 #4
base: staging
Are you sure you want to change the base?
Conversation
aad7ff3
to
f26e8ac
Compare
f9544a1
to
d57ddf7
Compare
3724489
to
678e7af
Compare
Hot reloading was moved out of this release goal - as we don't find it release blocking and there can be additional code changes that we would need to account for to ensure that it is synchronized across PCC and TM. This can be a fast follow or a seperate PR review. TODO:
|
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.
Unit test is failing: https://gist.github.com/luyzdeleon/c54fb0a449c5f5312521e28544bdd258
Good catch, I pushed a fix for the unit test |
7f0d37c
to
5bd0f61
Compare
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.
How to interpret this peer review
This peer review has 4 sections:
- Comments: These are general comments, mostly around architecture, design, nomenclature and other items, these are not meant to be strictly enforced, but are suggestions trying to improve the quality of this submission. Any requested changes will be in the body of the PR itself signaled at the line of the requested change.
- Follow up action items: These are items that are future improvements that can be implemented in a later revision.
- Failed unit tests: this is an account of failed unit tests performed by the reviewer to be fixed, if there are failed unit tests this PR is not going to be approved.
- Failed functional tests: This is a smoke screen test, where a few relevant functional use cases that touch this functionality are performed to make sure the functionality works. This does not replace a full regression test run, it's meant to ensure the reviewer fully understands the scope of the changes.
Comments
- I think that the "Lean" prefix is a necessary nomenclature to differentiate, but it might cause confusion and duplication across the codebase, e.g. ValidateLean, isSealedLean and several other functions. Existing functionality could have been easily extended via the
PocketConfig.LeanPocket
global config flag. One thing to note is that I do agree with CLI functions such asget-validators-lean
, because they allow the user to easily differentiate, however the codebase itself could have adapted without the code duplication. - I'm assuming
forceSetValidatorsLean
is meant to allow people to transform their current setups into "LeanPocket" without changing anything and just appending their existing validator to the list. If this is the case I like it and I think it will get people converted to the feature more easily. - A lot of the new functions do not have even a general comment about what they do at the signature of the function which could go a long way while reviewing/refactoring this code.
- I saw your
?
above theIsSealed
andSeal
functions in theSession
struct so I want to provide some more context: remember that theCacheObject
interface is shared with theEvidence
struct, which is sealed for the potential relay leak problem, in this case Sessions don't need to be sealed, which meansisSealed
just needs to return false.
Tendermint comments
- Several variables seem to be converted to slices which has singular names such as
LastSignState
andKey
, which could be converted to plural for better readability. - I would like to better understand why the
Synced
function was added at several places in the code. - In the
http
package, theSynced
function always returnsnil
, is this expected behaviour? - I don't see unit tests in the changes to the tendermint side.
Follow up action items (for a later revision)
- I don't know if I fully agree to having separated
SessionCache
perLeanNode
, when you could have a global cache, even though I read your comment about lock contentions or observed behaviors, but it could be advantageous in terms of reducing complexity and saving a bit of memory in cases where the siloed caches might contain the same information.
Failed unit tests
- https://gist.github.com/luyzdeleon/e55f79bebee6eed3a8de99cc71dc8eff
- https://gist.github.com/luyzdeleon/9b1bd34a4d1977b6d4cd2e74de54c9c3
Failed functional tests
- Functional tests were not performed as part of this review due to timeline and tooling restrictions.
DRY Concerns:I purposefully kept the code siloed as I was not sure to what extent making modifications to the original logic was going to be allowed and to allow for full backwards compatibility on the Pocket Core layer (though can still be achieve without DRY, just found this easier). I can make these modifications to reduce DRY by modifying arguments, parameters, and integrating logic between each methods but there is an added risk of modifying something that I shouldn't have and may not be caught in peer review. Here's are my suggestions:
If consolidating here's what I suggest (which aligns with what you recommend):
This should remove the majority of THE DRY code. Tendermint Sync CommentNever thought a discord message will ever end up into a Github PR, without further ado. Here is my reasoning by adding the sync method. It allows for more efficient relays https://discord.com/channels/553741558869131266/564836328202567725/983072466157072464 I wasn't aware that we are using the HTTP Client, so i had it as an empty stub for now. It was under assumption we only use the local client, but if needed, I can add the functionality. Tendermint comments
Failed unit tests
|
I agree with the DRY consolidation strategy in that we need to consolidate now, it's what's best for the project long term, as long as we have the correct unit/functional testing in place that confirms both the current functionality and the new functionality is working as intended. |
Merged in #12 PR Added a new struct called PocketNode
DRY Fixes
CacheObject interface changes
CacheObject changes
Challenge Request Modifications
Relay Metric changes
CLI Changes
Tendermint Consensus Reactor changes
Pocket Core Test changes
Planned Testing changes (TBD, have a WIP branch (expand-testing) for this, but shouldn’t be a blocker for code completeness, this is not same as our QA adds suites)
Known Bugs
|
I opened up a new PR for Integration tests: #13 that is based off this branch, @luyzdeleon |
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.
Mostly nomenclature contentions, we're on the right path with the codebase. My only major contention with this PR right now is the changes to the Status
function in the Tendermint node to ConsensusReactorStatus
, which I couldn't find in the fork here: https://github.com/fiagdao/tendermint/commits/leanfeatherpocket.
app/common_test.go
Outdated
privVal.Key.Address = pk.PubKey().Address() | ||
pocketTypes.InitPVKeyFile(privVal.Key) | ||
privVal := privval.GenFilePV(c.TmConfig.PrivValidatorKey, c.TmConfig.PrivValidatorState) | ||
privVal.Key[0].PrivKey = pk |
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.
Shouldn't this be privVal.Keys[0].PrivKey = pk
?
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.
Resolved
@@ -74,6 +74,7 @@ require ( | |||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect | |||
) | |||
|
|||
replace github.com/tendermint/tendermint => github.com/pokt-network/tendermint v0.32.11-0.20220420160934-de1729fc7dba | |||
//replace github.com/tendermint/tendermint => github.com/pokt-network/tendermint v0.32.11-0.20220420160934-de1729fc7dba | |||
replace github.com/tendermint/tendermint => ../tendermint |
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.
I understand that because this is referencing a private repository it will be complicated to add the proper dependency, however I want to surface that this file should be pointing to the correct version of our Tendermint fork after your PR there is approved.
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.
Last batch of nomenclature changes, let's rename all these Legacy
nomenclature to Global
.
@luyzdeleon Just one additional call out in regards to your earlier comment about siloed / shared evidence storages.
|
I added in a new GET request endpoint called This endpoint exposes the node(s) addresses under a pocket core client, and will aid in helping understanding our network consolidation and usage. This endpoint just like any other one is non critical to servicing, so users have the option to disable/enable it just like any other endpoint by whitelisting it. There is no in memory caching involved into this response and we leave up to the user to cache the responses (perhaps on the reverse proxy level). |
Co-authored-by: poktblade <[email protected]>
remove multiple goroutine spinup, add random sleep minimum for claim/proof fix storing session
… from a happy user path
09ab95a
to
4bfd9d0
Compare
can you verify what the issue might be @PoktBlade |
For transparency sakes:
This linked PR outlines the comments and conversations during the time in which LeanPokt was closed source. To read more about the reason behind closed source, please read Core team's comments on why it was closed source.
Disclaimer:
This PR has only been peer reviewed and is not Q/A tested yet. It should not be used in a production fleet. This should be only be used for testing purposes until it is properly Q/A tested. If you do run in production, do know you are assuming the risks of:
Name: ThunderStake (Pierre Spiegel & Addison Spiegel) | BaaS Pools LLC
Design Specification
pokt-network/pocket-core#1437
Please explain your change in detail.
LeanPocket is a large optimization to the Pocket Core’s Client (PCC) by allowing multiple nodes to utilize one full node. Servicers/Validators (node set) can now leverage the same state cache, and blockchain data, and no longer have to validate as many transactions in a block as the node set grows. This reduces the number of resources needed for “n” nodes to a constant number, O(N) to O(1) for memory, space, io, and networking. Read more here
Functional Goals
Modifications made to achieve aforementioned goals
PocketNode
for each incoming each relayPocketNode
structvalidator_address
tagIsCatchingUp
without overhead of loading all validatorsMisc changes
Design decisions
lean_pocket (bool)
or running with start argumentuseLean
.lean
and can later be removed or integrated completely in future RCs.Quick User Guide
/home/user/.pocket
) calledlean_nodes_keys.json
and format the file to look like a JSON array of private keys as follows:[ { "priv_key": "6f641136790803051ea5b944113434017560d10e10a1b319b6a62146bc83ee361b5d51ada3a55ed716a6e614c4a1459f19ef838cf8e3b20d7c90553d27c9fb61" } ]
pocket accounts set-validators <path to lean_nodes_keys.json>
lean_pocket : true
to your pocket configuration json file or launch pocket start with--useLean
Suggestions:
pocket start
argument to ensure that your validators are updated on each pocket start.pocket start
argument as it can delay restarting your full nodeTesting
Linked Issues
#1428