-
Notifications
You must be signed in to change notification settings - Fork 33
Changelog Persistence
user_name edited this page Aug 3, 2023
·
29 revisions
All notable changes to this module will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Adds savepoints and rollbacks implementation to TreeStore
- Add place-holder for local context and servicer token usage support methods
- Refactors the persistence treeStore to be an IntegratableModule
- Adds a logger to TreeStore
- Refactors the stateTrees implementation off of the PersistenceContext and into its in module
- Implements the new Update and Commit pattern with the SMT trees in the trees module
- Uses ":memory:" to signify when connecting to an in-memory database
- Renamed an error used by Badger / KVStore
- Improve comments used for mock generation
- Integrate lazy loading SMT (release v0.5.0) into V1
- Adds the BlockStore interface
- Updates the PersistenceContext struct to use BlockStore interface
- Refactors BlockStore into an independent component
- Creates the BlockStore interface and package
- Add protocol actor specifc getter functions
- Add placeholder functions for
GetSupportedChains()andGetVersionAtHeight() - Add the
network_idfield and local timestamp to block when preparing it
- Rename
TxResulttoIndexedTransaction - Have the
txIndexerindex transactions using the hash of the serialisedTransaction - Use the hash of the serialised
Transactionas the key for transactions in the transaction state tree
- Implemented a new
GetActorpersistence modular functoin - Added
fisherman_per_sessionparameter - Minor code and comment cleanup
- Index transactions in the
TxIndexerby sender and recipient using the height and block index of the transactions
- Remove persistent specific
TxResultprotobuf and interface - Utlise the
TxResultprotobuf inshared/core/types
- Update imports to use
pokt-network/smtinstead of the archivedcelestiaorg/smt
- Update
prepareBlock()function to add processed transactions to the persisted block
- Add
GetAllParams()function to retrieve all governance parameters at their most current values - Generalise
GetParameter()to be a wrapper function with a type parameter
- Fixed flag/params keying
- Updated pools read/write functions to use a real address, not a string that is named address and obviously is not hexadecimal
- Updated tests
- Added
SAVEPOINTS_ROLLBACKS.mddesign document
- Replaced all
pgx.Connwithpgxpool.Connto use postgres connection pooling - Consolidate and simplify
ReleaseandCloseandresetContextinto a single function - Introduced a
ConnectTimeoutto the postgres connection - Remove the unnecessary
getTxhelper - Maintain a pool of connections to the postgres DB rather than creating a new one each time
- Improve readability of
ReleaseWriteContext
- Updated to use
loggerwhere we were still usinglogfor the message "Storing block in block store"
- Update state hash test after modifying genesis (updated port numbers)
- Renamed package names and parameters to reflect changes in the rest of the codebase
- Removed the
StakeStatusconstants to use the global proto enum types - Removed the whole concept of
maxRelaysas we're introducing a new rate limiting approach - Added documentation to make certain things clearer
- Renamed
GenericParamtoServiceURL - Removed
txsOrderInBlockHashDescendingsince we don't need a hash specific to txs - it's part of the state hash
- Update logger value references with pointers
- Remove unnecessary (and problematic) logger calls
- Rename ServiceNode Actor Type Name to Servicer
- Module now embeds
base_modules.IntegratableModulefor DRYness
- Add a few
nolintcomments to fix the code on main
- Remove
IUnstakingActorand useUnstakingActordirectly; guideline for removing future unnecessary types (e.g. TxResult) - Typo in
GetMinimumBlockHeightQuery - Reduce unnecessary
string<->[]byteconversion in a few places - Fix bug in
updateUnstakedHeightIfPausedBeforethat was unstaking all actors
- Added mock generation to the
kvstore/kvstore.go.
- Minor documentation cleanup
- Address legacy linter errors from
golangci-lint
- Changed log lines to utilize new logger module
- Use hash of serialised protobufs for keys in
updateParamsTree()andupdateFlagsTree()
- Fix unit tests -
TestGetAppPauseHeightIfExists,TestGetAppOutputAddress,TestGetFishermanStatus,TestGetFishermanPauseHeightIfExists,TestGetFishermanOutputAddress,TestPersistenceContextParallelReadWrite,TestGetServicerPauseHeightIfExists,TestGetServicerOutputAddress,fuzzSingleProtocolActor,TestGetValidatorPauseHeightIfExists, andTestGetValidatorOutputAddressfor misplaced expected and actual values inrequire.Equal.
- Add logic for
updateParamsTree()andupdateFlagsTree()functions when updating merkle root hash
- Added
debug.FreeOSMemory()onResetToGenesisto free-up memory and stabilizeLocalNet.
- Consolidate common behaviour of
PoolandAccountfunctions into a shared interfaceProtocolAccountSchema - Create
account_shared_sql.goandtypes/account_shared_sql.goand renameshared_sql.goandtype/shared_sql.gotoactor_shared_sql.goandtypes/actor_shared_sql.goseperating shared sql logic
- Update the persistence module README, focusing on
pgadminand Makefile helpers
- Remove
Blockproto definition to consolidate undershared/core/types
- Add
max_conns_count,min_conns_count,max_conn_lifetime,max_conn_idle_timeandhealth_check_periodtoPersistenceConfig. - Update
connectToDatabasefunction indb.goto connect viapgxpoolto postgres database and acceptPersistenceConfiginterface as input. - Update
github.com/jackc/pgx/v4->github.com/jackc/pgx/v5.
- Add
init()function togov.goto build a map of parameter names and their types - Deprecated
GetBlocksPerSession()andGetServicersPerSessionAt()in favour of the more general parameter getter functionGetParameter() - Update unit tests replacing
GetIntParam()andGetStringParam()calls withGetParameter()
- Minor logging improvements
- Updated module constructor to accept a
busand not aruntimeMgranymore - Registering module with the
busviaRegisterModulemethod - Updated tests and mocks accordingly
- Renamed
InitParamstoInitGenesisParams
- Added missing
ActorTypeinGetAllXXXX()functions - Updated to new
PoolNamesenums - Using
Enum.FriendlyName()instead ofEnum.String()forPoolNamesenums (backward compatibility + flexibility) - Updated
InitParamsso that Params can be initialized from aGenesisStateand not just hardcoded - Refactored default values sourcing (test_artifacts for tests)
- Updated tests
- Consolidated
persistence/docs/CHANGELOGandpersistence/CHANGELOG.mdintopersistence/docs/CHANGELOG
- Updated to use centralized config and genesis
- Updated to use
Accountstruct now undercoreTypes - Tended for the TODO "// TODO (Andrew) genericize the genesis population logic for actors #149" in
persistence/genesis.go - Updated tests to use the new config and genesis handling
- Updated statetest hashes to reflect updated genesis state
- Remove
SetProposalBlockand local vars to keep proposal state - Add
proposerAddrto theCommitfunction - Move the
PostgresContextstruct tocontext.db
- Moved Actor related getters from
genesis.gotoactor.go - Added
GetAllStakedActors()that returns all Actors
- Changed the scope of
TransactionExistsfrom thePostgresContextto thePersistenceModule
Core StateHash changes
- Introduced & defined for
block_persistence.proto- A persistence specific protobuf for the Block stored in the BlockStore
- On
Commit, prepare and store a persistence block in the KV Store, SQL Store - Replace
IndexTransactions(plural) toIndexTransaction(singular) - Maintaining a list of StateTrees using Celestia’s SMT and badger as the KV store to compute the state hash
- Implemented
ComputeStateHashto update the global state based on:- Validators
- Applications
- Servicers
- Fisherman
- Accounts
- Pools
- Transactions
- Added a placeholder for
paramsandflags
- Added a benchmarking and a determinism test suite to validate this
Supporting StateHash changes
- Implemented
GetAccountsUpdated,GetPoolsUpdatedandGetActorsUpdatedfunctions - Removed
GetPrevAppHashandindexTransactionsfunctions - Removed
blockProtoBytesandtxResultsfrom the local state and addedquorumCert - Consolidate all
resetContextrelated operations into a single function - Implemented
ReleaseWriteContext - Implemented ability to
ClearAllStateandResetToGenesisfor debugging & testing purposes - Added unit tests for all of the supporting SQL functions implemented
- Some improvements in unit test preparation & cleanup (limited to this PR's functionality)
KVStore changes
- Renamed
PuttoSet - Embedded
smt.MapStorein the interface containingGet,SetandDelete - Implemented
Delete - Modified
GetAllto return bothkeysandvalues - Turned off badger logging options since it’s noisy
- Rename
GetBlockHashtoGetBlockHashAtHeight - Reduce visibility scope of
IndexTransactionstoindexTransactions - Remove
quorumCertificatefrom the local context state - Remove
LatestQCandSetLatestQC - Remove
Latestprefix from several functions including related to setting context of the proposal block - Added
ReleaseWriteContextplaceholder - Replaced
ResetContextwithRelease
- Changed the following exported functions to lowercase non-exported functions
- [./pocket/persistence/]
- GetActor
- GetActorFromRow
- GetChainsForActor
- SetActorStakeAmount
- GetActorStakeAmount
- GetCtxAndTx
- GetCtx
- SetValidatorStakedTokens
- GetValidatorStakedTokens
- [./pocket/persistence/types]
- ProtocolActorTableSchema
- ProtocolActorChainsTableSchema
- SelectChains
- ReadyToUnstake
- InsertChains
- UpdateUnstakingHeight
- UpdateStakeAmount
- UpdatePausedHeight
- UpdateUnstakedHeightIfPausedBefore
- AccToAccInterface
- TestInsertParams
- AccountOrPoolSchema
- InsertAcc
- SelectBalance
- [./pocket/persistence/test]
- GetGenericActor
- NewTestGenericActor
- Ported over storing blocks and block components to the Persistence module from Consensus and Utility modules
- Encapsulated
TxIndexerlogic to the persistence context only
- Fixed
ToPersistenceActors()by filling all structure fields - Deprecated
BaseActor->Actor - Changed default actor type to
ActorType_Undefined
#235 Config and genesis handling
- Updated to use
RuntimeMgr - Made
PersistenceModulestruct unexported - Updated tests and mocks
- Removed some cross-module dependencies
- Added
TxIndexersub-package (previously in Utility Module) - Added
TxIndexerto bothPersistenceModuleandPersistenceContext - Implemented
TransactionExistsandStoreTransaction
- Don't ignore the exit code of
m.Run()in the unit tests - Fixed several broken unit tests related to type casting
- Removed no-op
DeleteActorcode - Consolidated
CHANGELOGs into one underpersistence/docs - Consolidated
READMEs into one underpersistence/docs - Deprecated
persMod.ResetContext()for ->persRWContext.ResetContext()for more appropriate encapsulation - Added ticks to CHANGELOG.md
- Removed reference to Utility Mod's
BigIntToString()and used internalBigIntToString()
- Consolidated
PostgresContextandPostgresDbinto a single structure
Encapsulate structures previously in shared #163
- Renamed schema -> types
- Added genesis, config, and unstaking proto files from shared
- Ensured proto structures implement shared interfaces
- Populate
PersistenceGenesisStateuses shared interfaces in order to acceptMockPersistenceGenesisState - ^ Same applies for
PersistenceConfig - Bumped cleanup TODOs to #149 due to scope size of #163
Main persistence module changes:
- Split
ConnectAndInitializeDatabaseintoconnectToDatabaseandinitializeDatabase- This enables creating multiple contexts in parallel without re-initializing the DB connection
- Fix the SQL query used in
SelectActors,SelectAccounts&SelectPools- Add a generalized unit test for all actors
- Remove
NewPersistenceModuleand an injectedConfig+Create- This improves isolation a a “injection-like” paradigm for unit testing
- Change
SetupPostgresDockertoSetupPostgresDockerPersistenceMod- This enables more “functional” like testing by returning a persistence module and avoiding global testing variables
- Only return once a connection to the DB has been initialized reducing the likelihood of test race conditions
- Implemented
NewReadContextwith a proper read-only context - Add
ResetContextto the persistence module andCloseto the read context
Secondary persistence module changes
- Improve return values in
CommitandRelease(return error, add logging, etc…) - Add
pgx.Connpointer toPostgresDB -
s/db/conn/gands/conn/tx/gin some (not all) places where appropriate - Make some exported variables / functions unexported for readability & access purposes
- Add a few helpers for persistence related unit testing
- Added unit tests and TODOs for handling multiple read/write contexts
Deprecate PrePersistence
- Fix for bytes parameters
- Accounts / pools default to 0
- Pre-added accounts to genesis file
- Separated out Persistence Read Context from Persistence Write Context
- Added various TODO's in order to code-complete a working persistence module
- Added genesis level functions to GetAllActors() and GetAllAccounts/Pools() for testing
- Added PopulateGenesisState function to persistence module
- Fixed the stake status iota issue
- Discovered and documented (with TODO) double setting parameters issue
- Attached to the Utility Module and using in
make lightweight_localnet
Pocket Persistence 1st Iteration (https://github.com/pokt-network/pocket/pull/73)
- Base persistence module implementation for the following actors:
Account,Pool,Validator,Fisherman,Servicer,Application - Generalization of common protocol actor behvaiours via the
ProtocolActorandBaseActorinterface and implementation - A PostgreSQL based implementation of the persistence middleware including:
- SQL query implementation for each actor
- SQL schema definition for each actor
- SQL execution for common actor behaviours
- Golang interface implementation of the Persistence module
- Update to the Persistence module interface to enable historical height queries
- Library / infrastructure for persistence unit fuzz testing
- Tests triggered via
make test_persistence
Contents
- Home
- Persistence
- Changelog
-
Persistence
- Indexer
- Rpc
- Runtime
- State_Machine
-
Guides
- Roadmap
-
Guides
- Learning
- Guides
-
Guides
- Contributing
- Devlog
-
Guides
- Dependencies
-
Guides
- Releases
- Guides
- P2P
-
Shared
- Crypto
- Shared
-
Shared
- Modules
-
Build
- Config
- Consensus
-
Guides
- Telemetry
- Utility
- Logger