-
Notifications
You must be signed in to change notification settings - Fork 33
[TECHDEBT] Update usages of PersistenceRWContext gov parameter accessors to use the more general GetParameter() function #436
Description
Objective
Update the different instances across Persistence and Utility, and anywhere else the PersistenceRWContext interface is used, to use the general GetParameter(paramName string, height int64) (any, error) function to access gov parameters.
This will include replacing the usages of GetStringParam(), GetIntParam() and GetBytesParam() and replacing them all with GetParameter() where this is appropriate. This is with the aim of reducing the code footprint across the modules affected.
Another part of this issue involves updating the logic of GetParameter() to automatically distinguish between string and []bytes types given the paramName string. This must be done in a way that does not restrict the project from expanding the parameters without breaking the logic of this function.
Origin Document
Since the merge of PR#422 the new generalised getter function GetParameter() has been implemented and has deprecated GetBlocksPerSession() and GetServiceNodesPerSessionAt(). However, all the other parameter accessor functions are not using this new generalised function yet.
Goals
- Replace all gov parameter accessor functions using
GetStringParam(),GetIntParam()orGetBytesParam()to useGetParameter() - Update unit tests in
persistence/test/gov_test.goandutility/test/gov_test.goto use theGetParameter()function - Solve the issue around when to call the
[]bytesvariation ofGetParameter()depending on the parameter name string
Deliverable
- Update gov parameter accessors to use the
GetParameter()function - Update unit tests in
persistence/test/gov_test.goandutility/test/gov_test.goto use theGetParameter()function where appropriate - Update the logic of
GetParameter()to detect[]bytetypes and distinguish them fromstringtypes automatically
Non-goals / Non-deliverables
- Restrict the expansion of the gov parameters by adding specific type detection rules to
GetParameter()that would inhibit parameter additions that don't follow the current patterns.
General issue deliverables
- Update the appropriate CHANGELOG(s)
- Update any relevant local/global README(s)
- Update relevant source code tree explanations
- Add or update any relevant or supporting mermaid diagrams
Testing Methodology
- Task specific tests or benchmarks:
make ... - New tests or benchmarks:
make ... - All tests:
make test_all - LocalNet: verify a
LocalNetis still functioning correctly by following the instructions at docs/development/README.md
Creator: @h5law
Metadata
Metadata
Assignees
Labels
Type
Projects
Status