-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Utility] Foundational bugs, tests, code cleanup and improvements (1 …
…/ 2) (#503) ## 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): - [ ] New feature, functionality or library - [x] Bug fix - [x] Code health or cleanup - [ ] Major breaking change - [x] Documentation - [ ] Other <!-- add details here if it a different type of change --> ## List of changes ### Changes **Utility** - Add a `Validatable` type for basic validation - Split business logic specific to certain actors (e.g. validator reward, app relays, message handling) into separate files - Reduce the scope of functions and types that shouldn’t be exposed - Upgraded the actors tests - a lot went here to help with understanding what’s going on but it’s still just a start - Remove the `Context` struct; unnecessary abstraction - Added comments and guidance on message, transaction and signature validation - Added `ITransaction`, an interface for the `Transaction` protocol to help capture the functionality it adds to the core type **Code Confusion** - Remove `IUnstakingActor` and use `UnstakingActor` directly. Guideline for removing future unnecessary types (e.g. TxResult) - Delineate between unstaking & unbonding in a few places throughout the codebase **Bugs** - Avoid unstaking all actors when intending to UnstakeMsg paused actors only (major bug in persistence sql query) - `tx.Equals` was comparing the same transaction against itself (major bug) - Staking status enums in utility did not reflect the same protocol as in persistence (needs to be consolidated) **Code optimization** - Avoid redundant `byte` <-> `string` conversions in several places - Avoid redundant `bigInt` <-> `string` conversions in several places **Code health** - Add comments explaining the use/responsibility of various types - Consolidate BigInt/String converters used in other parts of the codebase - Consolidate some types used everywhere (e.g. `actorTypes`) - Reduce the code footprint of the `codec` package & add some TODOs - Removed unused double sign code (moved to #432 for reference) ### Files focused on utility - [x] ├── account.go - [x] ├── account_test.go - [x] ├── actor.go - [x] ├── actor_test.go - [ ] ├── application.go - [ ] ├── application_test.go - [ ] ├── block.go - [ ] ├── block_test.go - [ ] ├── context.go - [ ] ├── doc - [ ] │ ├── CHANGELOG.md - [ ] │ ├── PROTOCOL_RELAY.md - [ ] │ ├── PROTOCOL_SESSION.md - [ ] │ └── README.md - [ ] ├── gov.go - [ ] ├── gov_test.go - [ ] ├── message_handler.go - [ ] ├── message_test.go - [ ] ├── module.go - [ ] ├── module_test.go - [ ] ├── service - [ ] │ └── service.go - [ ] ├── session.go - [ ] ├── transaction.go - [ ] ├── transaction_test.go - [ ] ├── types - [x] │ ├── constants.go - [x] │ ├── error.go - [x] │ ├── gov.go - [x] │ ├── message.go - [x] │ ├── message_staking.go - [x] │ ├── message_test.go - [ ] │ ├── proto - [ ] │ │ ├── message.proto - [ ] │ │ ├── stake_status.proto - [ ] │ │ ├── transaction.proto - [ ] │ │ ├── tx_result.proto - [ ] │ │ └── utility_messages.proto - [x] │ ├── relay_chain.go - [x] │ ├── relay_chain_test.go - [x] │ ├── signature.go - [ ] │ ├── transaction.go - [ ] │ ├── transaction_test.go - [x] │ ├── tx_fifo_mempool.go - [x] │ ├── tx_fifo_mempool_test.go - [ ] │ ├── tx_result.go - [x] │ └── validatable.go - [ ] └── validator.go ## 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 - [ ] I have updated the corresponding CHANGELOG ### If Applicable Checklist - [x] 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>
- Loading branch information
Showing
87 changed files
with
3,028 additions
and
3,221 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.