-
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] Consolidate common behaviour between Pool
and Account
into a shared interface
#102
Comments
Note: I am currently working on this. |
+1 Updated you as an owner in the description changed this to in progress |
@DragonDmoney Do you think this is something you can have up for review by the end of the month? |
Spoke to @DragonDmoney offline and he mentioned he won't be working on this any longer. |
@Olshansk I would like to take a swing at this issue if its still relevant? I have working code that passes tests ready to submit a PR if its still applicable? |
Still applicable, let's do it! |
…t` into a shared interface (Issue #102) (#442) ## Description This PR addresses issue #102. It consolidates `Account` and `Pool` to use a shared interface `ProtocolAccountSchema` that generalises the functions that both actors use. The `ProtocolAccountSchema` interface is implemented by the `baseProtocolAccountSchema` struct - following the same pattern laid out by the `ProtocolActorSchema` and `baseProtocolActorSchema`. Two new types are then created - `Account` and `Pool` these are instances of the `baseProtocolAccountSchema` struct and are initiated with their relevant `SQL` table names, height constraints and column names. The functions in the `PersistenceRWContext` for both `Account` and `Pool` utilities are now generalised to use shared logic dramatically reducing the code footprint. In addition to this all relevant unit tests have been updated and usages of these functions are working correctly. Also regarding issue #149 `address []bytes` has been removed from `InsertPool`. ## Issue Fixes #102 ## 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 - Create `ProtocolAccountSchema` interface and `baseProtocolAccountSchema` struct that implements this interface - Create `Account` and `Pool` types that share the common functionality of `baseProtocolAccountSchema` - Generalise all `Account` and `Pool` functions to use shared logic - Remove `address []byte` from `InsertPool()` - Seperate `shared_sql.go` and `types/shared_sql.go` into `account_shared_sql.go` and `actor_shared_sql.go` as well as `types/account_shared_sql.go` and `types/actor_shared_sql.go` respectively ## 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 - [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)
Objective
Remove redundant code used by the
Pool
andAccount
actors in the persistence module introduced in #73.This is a good starter task opportunity to get acquainted with the codebase in the persistence module.
Origin Document
From the utility specification, a
Pool
is described as:Similar to how the functionality of Fisherman, ServiceNode, Validator and Application was consolidated via
persistence/schema/protocol_actor.go
andpersistence/schema/base_actor.go
, the functionality of Pool and Account can also be shared to remove redundant code.Goals
Deliverables
Pool
andAccount
into a common interfacepersistence/schema/account.go
,persistence/account.go
,persistence/test/account_test.go
Testing Methodology
$ make test_persistence
$ make test_all
LocalNet
following the instructions indocs/development/README.md
Non-goals
Creator: @Olshansk
Owner: @DragonDmoney
Co-Owners: @andrewnguyen22
The text was updated successfully, but these errors were encountered: