[Utility] Foundational bugs, tests, code cleanup and improvements (1 / 2)#503
Merged
[Utility] Foundational bugs, tests, code cleanup and improvements (1 / 2)#503
Conversation
Olshansk
commented
Feb 12, 2023
shared/codec/codec.go
Outdated
| } | ||
|
|
||
| var _ Codec = &ProtoCodec{} | ||
| type ICodec proto.Message |
Collaborator
Author
There was a problem hiding this comment.
I added it, but then actually did not end up using it as intended.
The idea was to show that some of our interfaces add functionality to serializable types based on the codec we're using.
_ codec.ICodec = &Transaction{}
I'm removing it for now (since it is extra code that doesn't provide much benefit), but we should discuss that this is a very implicit design pattern others might not understand.
Adding the following in codec.go in the meantime:
// DOCUMENT: Some of the types through the code based (e.g. Transaction) are defined via serializable
// files (e.g. .proto files) and add functionality defined in go on top of it (e.g. ITransaction). This
// a very implicit design pattern that may be non-obvious to new developers.
shared/codec/codec.go
Outdated
| } | ||
|
|
||
| var _ Codec = &ProtoCodec{} | ||
| type ICodec proto.Message |
Collaborator
Author
There was a problem hiding this comment.
After doing the above and running tests, I got the following errors:
utility/types/message.go:179:20: msg.ProtoReflect undefined (type Message has no field or method ProtoReflect)
utility/types/message.go:183:38: cannot use msg (variable of type Message) as type protoreflect.ProtoMessage in argument to codec.GetCodec().Marshal:
For now, I've renamed ICodec to CodecType so I can embed it in message but going to keep thinking.
41 tasks
deblasis
reviewed
Feb 14, 2023
deblasis
approved these changes
Feb 14, 2023
bryanchriswhite
added a commit
that referenced
this pull request
Feb 20, 2023
* pokt/main: [Infra] KISS 3 - Cluster Manager [Merge me after #521] - (Issues: #490) (#522) Refactor/fix state sync logs (#515) [P2P] KISS 2 - Peer discovery [Merge me after #520] - (Issues: #416, #429) (#521) [Core] KISS 1 - Finite State Machine [Merge me first] - (Issue: #499) (#520) [CLI] Stake command bugfix (#518) [CLI] Cannot run make localnet_client_debug: Cannot initialise the keybase with the validator keys: Unable to find YAML file (#517) Fix the link shown by `make go_doc` Fixed duplicate GITHUB_WIKI tag [Documentation] Update Devlog Formatting (#512) [Docs & Bugs] Minor fixes post keybase changes (#513) [Utility] Foundational bugs, tests, code cleanup and improvements (1 / 2) (#503) [Tooling] Integrate Keybase w/ CLI (Issue #484 ) (#501) update devlog2.md update devlog2.md Update devlog1.md
bryanchriswhite
added a commit
that referenced
this pull request
Feb 20, 2023
* pokt/main: [Infra] KISS 3 - Cluster Manager [Merge me after #521] - (Issues: #490) (#522) Refactor/fix state sync logs (#515) [P2P] KISS 2 - Peer discovery [Merge me after #520] - (Issues: #416, #429) (#521) [Core] KISS 1 - Finite State Machine [Merge me first] - (Issue: #499) (#520) [CLI] Stake command bugfix (#518) [CLI] Cannot run make localnet_client_debug: Cannot initialise the keybase with the validator keys: Unable to find YAML file (#517) Fix the link shown by `make go_doc` Fixed duplicate GITHUB_WIKI tag [Documentation] Update Devlog Formatting (#512) [Docs & Bugs] Minor fixes post keybase changes (#513) [Utility] Foundational bugs, tests, code cleanup and improvements (1 / 2) (#503) [Tooling] Integrate Keybase w/ CLI (Issue #484 ) (#501) update devlog2.md update devlog2.md Update devlog1.md
16 tasks
Olshansk
added a commit
that referenced
this pull request
Feb 28, 2023
…3) (#550) ## Description The second of three changes necessary to refactor and improve the utility module to enable implementation of future, more complex, interfaces. While the list of changes in #503 was more bug & testing focused, this PR was more readability & documentation focused in preparation for M3. ## Issue Fixes #504 ## Type of change Please mark the relevant option(s): - [ ] New feature, functionality or library - [x] Bug fix - [x] Code health or cleanup - [x] Major breaking change - [ ] Documentation - [ ] Other <!-- add details here if it a different type of change --> ## List of changes - Fixed bug where we were not removing txs from the mempool of replicas - Improved the readability of the `Block` lifecycle and `Message` validation - Replace unnecessary functions in such as `Store()`, `getStoreAndHeight()` and a few otherwise - Moved the `Transaction` proto to the shared module - Added documentation to `TxResult` result and removed `DefaultTxResult` and - Added extensive documentation to functions involved in the Block lifecycle - Removed unnecessary fields from the `BlockHeader` - Renamed `GenericParam` to `ServiceURL` - Consolidated `StakeStatus` in the shared package - Renamed governance parametesr related to rate limitting Applications - Renamed `applyTx` to `hydrateTx` and added documentation on its functionality ## 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) --- Co-authored-by: Alessandro De Blasis <alex@deblasis.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
This is the first of several changes necessary to refactor and improve the utility module to enable implementation of future, more complex, interfaces.
Issue
Fixes #475
Type of change
Please mark the relevant option(s):
List of changes
Changes
Utility
Validatabletype for basic validationContextstruct; unnecessary abstractionITransaction, an interface for theTransactionprotocol to help capture the functionality it adds to the core typeCode Confusion
IUnstakingActorand useUnstakingActordirectly. Guideline for removing future unnecessary types (e.g. TxResult)Bugs
tx.Equalswas comparing the same transaction against itself (major bug)Code optimization
byte<->stringconversions in several placesbigInt<->stringconversions in several placesCode health
actorTypes)codecpackage & add some TODOsFiles focused on
utility
Testing
make develop_testREADMERequired Checklist
If Applicable Checklist
shared/docs/*if I updatedshared/*README(s)