-
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
[Persistence] Followup on PrePersistence deprecation & Block lifecycle #165
Conversation
#73) ## Objective Foundational iteration of PostgreSQL based persistence module implementation. ## Origin Document #68 ## Type of change New major module implementation. ### Persistence-related core changes: - List of actors / interfaces with MVP implementation: - Applications - Fisherman - ServiceNode - Accounts - Pools - List of actors / interfaces with partial MVP implementation: - Validator - Gov params - List of actors / interfaces with minorimplementation: - Block - SQL Schema definition of the actors above - SQL Query implementation for common actor persistence functionality - PostgresContext implementation of the actors actors above - Base infrastructure for fuzz testing Non-persistence “fly-by” changes - Updates to the PrePersistence module and utility module with breaking changes - A few minor improvements/additions to the Makefile - TODOs & comment cleanups throughout the codebase ## How Has This Been Tested? ### Unit Tests ``` make test_persistence make test_all ``` ### LocalNet Ran a basic LocalNet following the instructions in the [development README](docs/development/README.md). Co-authored-by: Daniel Olshansky <olshansky.daniel@gmail.com> Co-authored-by: Andrew Nguyen <andrewnguyen@Andrews-MacBook-Pro-2.local> Co-authored-by: Andrew Nguyen <andrewnguyen@Andrews-MBP-2.lan> Co-authored-by: Daniel Olshansky <olshansky@pokt.network>
…tence-foundation-interim-merge' into issue-#111
… to read / write separation
@andrewnguyen22 Please take a look at this PR and lmk if there any additional changes you'd like for me to make. |
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.
All looks good. 99% there. Just two comments
@andrewnguyen22 Please take a close look at the commits between HEAD and |
|
EDIT: I'm thinking that even though we're going to remove it in https://github.com/pokt-network/pocket/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc, I'll add back the previous block lifecycle / should hydrate genesis logic so we have a more stable main with less bugs. @andrewnguyen22 comment regarding the genesis / lifecycle piece. When we added the blockstore in #121 , we also added a
My understanding is that per the other comments / discussions (screenshot below), we didn't want to bring it back in favor of the future configs changes happening, but I had to add a couple stop-gap hacks in the meantime so that we load up the genesis correctly every time. I'd personally prefer to add it back in this PR so there are less hacks / confusion, but also unsure per you your other comments. Lmk how you think I should proceed. |
@andrewnguyen22 I removed the hacks, added the TODOs and replied to some of the outstanding comments. Even though we'll make it more real in the next config change and delete some of this, it'll avoid us having more hacks, and a better baseline we can reference or revert to on mainline. I added a small gif showing the state being loaded when we restart local net and some of the tooling we can use to investigate it manually. The quality is low because github messages is limited to 10MB but a full video is available here. |
#### Intention Currently merge ready with #128 but not considering #165 since it's under active development. ## Description - Deprecated old placeholder genesis_state and genesis_config - Added utility_genesis_state to genesis_state - Added consensus_genesis_state to genesis_state - Added genesis_time to consensus_genesis_state - Added chainID to consensus_genesis_state - Added max_block_bytes to consensus_genesis_state - Added accounts and pools to utility_genesis_state - Added validators to utility_genesis_state - Added applications to utility_genesis_state - Added service_nodes to utility_genesis_state - Added fishermen to utility_genesis_state - Deprecated shared/config/ - Added new shared config proto3 structure - Added base_config to config - Added utility_config to config - Added consensus_config to config - Added persistence_config to config - Added p2p_config to config - Added telemetry_config to config - Opened followup issue #163 - Added config and genesis generator to build package - Deprecated old build files - Use new config and genesis files for make compose_and_watch - Use new config and genesis files for make client_start && make client_connect closes #154 ## Type of change Please mark the options that are relevant. - [x] New feature (non-breaking change which adds functionality) - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation - [ ] Other (<_REPLACE_ME_WITH_DETAILS_>) ## How Has This Been Tested? make test_all && make compose_and_watch - [x] `make test_all` - [x] [LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md) ## 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] If applicable, I have made corresponding changes to related or global README - [ ] If applicable, I have added added new diagrams using [mermaid.js](https://mermaid-js.github.io) - [ ] If applicable, I have added tests that prove my fix is effective or that my feature works --- Co-authored-by: Daniel Olshansky <olshansky.daniel@gmail.com> Co-authored-by: Andrew Nguyen <andrewnguyen@Andrews-MacBook-Pro-2.local> Co-authored-by: Andrew Nguyen <andrewnguyen@Andrews-MBP-2.lan> Co-authored-by: Daniel Olshansky <olshansky@pokt.network>
Objective
Follow up on both critical and non-critical fixes to #140.
Origin Document
#140 deprecated PrePersistence and implemented multiple contexts. This PR is a follow with some stylistic changes, improvements in the readability of the tests, the addition of unit tests, bug fixes in some SQL business logic, and implementation of the read context.
Followup work is being tracked in #149.
Learnings to streamline workflow in the future
Changelog / changes
Main persistence module changes:
ConnectAndInitializeDatabase
intoconnectToDatabase
andinitializeDatabase
SelectActors
,SelectAccounts
&SelectPools
NewPersistenceModule
and an injectedConfig
+Create
SetupPostgresDocker
toSetupPostgresDockerPersistenceMod
NewReadContext
with a proper read-only contextSecondary persistence module changes
Commit
andRelease
(return error, add logging, etc…)pgx.Conn
pointer toPostgresDB
s/db/conn/g
ands/conn/tx/g
in some (not all) places where appropriateGeneral milestone checklist
Follow-up Work
All follow-up work is being tracked in #149
Checklist