-
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 (Issue #102)
#442
Conversation
@Olshansk I have also addressed the discussion comment in the |
Pool
and Account
into a shared interface (Issue #102)
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.
@h5law LGTM!
Just a couple things regarding review:
- Make sure to re-request review when you need me to take another look
- Don't hesitate to resolve the comments yourself if your confident you addressed the comment
- Just double checking that LocalNet works fine? If so, go ahead and squash-and-merge!
I thought I did these but will make sure going forward 🫡
All good - will update CHANGELOGs and merge after that |
Description
This PR addresses issue #102. It consolidates
Account
andPool
to use a shared interfaceProtocolAccountSchema
that generalises the functions that both actors use.The
ProtocolAccountSchema
interface is implemented by thebaseProtocolAccountSchema
struct - following the same pattern laid out by theProtocolActorSchema
andbaseProtocolActorSchema
. Two new types are then created -Account
andPool
these are instances of thebaseProtocolAccountSchema
struct and are initiated with their relevantSQL
table names, height constraints and column names.The functions in the
PersistenceRWContext
for bothAccount
andPool
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 fromInsertPool
.Issue
Fixes #102
Type of change
Please mark the relevant option(s):
List of changes
ProtocolAccountSchema
interface andbaseProtocolAccountSchema
struct that implements this interfaceAccount
andPool
types that share the common functionality ofbaseProtocolAccountSchema
Account
andPool
functions to use shared logicaddress []byte
fromInsertPool()
shared_sql.go
andtypes/shared_sql.go
intoaccount_shared_sql.go
andactor_shared_sql.go
as well astypes/account_shared_sql.go
andtypes/actor_shared_sql.go
respectivelyTesting
make develop_test
README
Required Checklist
If Applicable Checklist
shared/docs/*
if I updatedshared/*
README(s)