-
Notifications
You must be signed in to change notification settings - Fork 12
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
[Application] Implement MsgStakeApplication & Add Extensive Tests #59
Conversation
@@ -6,7 +6,7 @@ import ( | |||
"pocket/app" | |||
) | |||
|
|||
func initSDKConfig() { | |||
func InitSDKConfig() { |
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.
If this is only being exposed for testing purposes, wdyt about adding a test_config.go
file which exposes a wrapper and has a //go:build test
tag/constraint?:
//go:build test
package cmd
// InitSDKConfig exports initAppConfig for use in tests
func InitSDKConfig() {
initSDKConfig()
}
We would have to update the makefile as well:
.PHONY: go_test
go_test: go_version_check ## Run all go tests
go test -v -tags test ./...
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.
I gave this a shot, but not a fan that new go developers would be confused by the fact that go test ./...
doesn't work out of the box. Added a TODO_DISCUSS
for now and will revisit after this PR.
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.
Previously we had discussed adding //go:build test
to all test files to mitigate this concern. The user experience would be that without the -tags test
constraint, the go test
would say that "no tests were run".
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.
I added a TODO link to this discussion. Is it alright if follow up on it outside of this PR?
If we do go with this approach, we should have really good CLI communication to the user to make it obvious how necessary the tag is like YOU HAVE NOT ADDED THIS TAG SO NO TESTS ARE BEING EXECUTED
.
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.
For sure, we can continue that discussion after this PR.
I'm just now recalling that had also done what you're suggesting 😂. IIRC, there was a test which did not have the test
build constraint and would check whether the -tags
flag contained test
, and return a similar error if not. I'll see if I can find it but otherwise, it should be straightforward to reproduce.
* main: [Miner, Supplier] chore: scaffold submit-proof message (#44) [Application] Implement MsgUnstakeApplication & Add Extensive Tests (#72) [Gateway] Implement UnstakeGateway message and add Tests (#75) [Gateway] Implement StakeGateway Message and Add Tests (#68) [Application] Implement MsgStakeApplication & Add Extensive Tests (#59) [CI] fix: run `make go_mockgen` step (#63)
* feat/observable: chore: last minute improvements chore: review improvements chore: improve comment chore: misc. review feedback improvements chore: improve comments refactor: rename `Observable#Close()` to `#UnsubscribeAll()` chore: improve comments chore: improve comments chore: cleanup, simplification, review improvements [Miner, Supplier] chore: scaffold submit-proof message (#44) [Application] Implement MsgUnstakeApplication & Add Extensive Tests (#72) [Gateway] Implement UnstakeGateway message and add Tests (#75) [Gateway] Implement StakeGateway Message and Add Tests (#68) [Application] Implement MsgStakeApplication & Add Extensive Tests (#59) [CI] fix: run `make go_mockgen` step (#63)
## Summary https://github.com/pokt-network/poktroll/assets/1892194/ffe3158d-a1b3-4672-8e0b-e673349067d2 ### Human Summary - Various small helpers (e.g. Makefile) - Shared helpers for unit tests - Add `stake` to the `Application` type - Add `stake` to the `MsgStakeApplication` command - Implement unit tests in all related parts of the codebase (CLI, genesis, keeper, etc...) with the exception of the `simulation` package --- Co-authored-by: harry <[email protected]> Co-authored-by: Bryan White <[email protected]>
Summary
Screen.Recording.2023-10-16.at.5.11.57.PM.mov
Human Summary
stake
to theApplication
typestake
to theStakeApplication
commandsimulation
packageAuto-Generated Summary
Summary generated by Reviewpad on 18 Oct 23 14:36 UTC
This pull request includes the following changes:
In the file
README.md
, the project name has been changed from "pocket" to "poktroll". The project description has also been updated to reflect the use of Rollkit, Cosmos SDK, and CometBFT for the Shannon upgrade of the Pocket Network blockchain. The sections "Getting Started" and "Release" have been added, while the sections "Configure", "Web Frontend", and "Learn more" have been removed. The "Install" section has been updated with instructions for installing the latest version of the blockchain node's binary.A new file
tx_stake_application_test.go
has been added in thecli
package of thex/application
module. This file contains test cases for thestake application
CLI command. The tests cover various scenarios, such as staking with valid inputs, missing address, invalid address, missing stake, invalid stake denom, and invalid stake amount.In a file, a new import statement for the package
github.com/cometbft/cometbft-db
has been added. Additionally, some import statements have been updated and commented. A functioninitSDKConfig()
has been changed toInitSDKConfig()
.In the file
go.mod
, some changes have been made to the "require" section. New modules have been added, and one module has been removed. Thegoogle.golang.org/genproto
module has been updated.The file
config.yml
has undergone changes. The names of some accounts in theaccounts
section have been modified. Thegenesis
section has been updated with additional information and comments.Changes have been made to the file
application.go
. An import statement forgithub.com/cosmos/cosmos-sdk/types
has been added, and thetypes
package frompocket/x/application
has been imported.A new mock for the BankKeeper has been added in a file. The file also includes modifications to the ApplicationKeeper to use this mock.
The file
errors.go
has been updated with changes to import statements and the addition of new error variables.The file
genesis_test.go
has been modified with changes to import statements, comments, and theTestGenesis
function.The file
MessageStakeApplication
in thetypes
package has been updated with changes to import statements and the addition of a new field.The
.gitignore
file has undergone changes, including the addition of patterns to ignore specific file extensions.Modifications have been made to the Makefile, including changes to variables, the addition of new commands, and reordering of existing commands.
The
openapi.yml
file has been changed with additions to theapplication
object in multiple places.The file
genesis.go
has been updated with changes to import statements and the addition of validation logic.The file
app.go
has been modified with changes to import statements, the introduction of a constant, and the addition of a comment.The file
mocks.go
has been added, providing documentation on dynamically generated structs.The file
tx_stake_application.go
has been modified with changes to import statements, command descriptions, and the addition of logic to parse and validate the stake amount.The file
keeper_test.go
has been added, containing test cases for theMsgServer_StakeApplication
function in the keeper package.The file
genesis_test.go
has been modified with changes to import statements and the addition of test cases for the validation of the GenesisState struct.The file
sample_test.go
has been added, containing test cases for validating the ApplicationList field in the GenesisState struct.The file
.github/workflows/go.yml
has undergone changes, involving reordering of steps and modifications to the "Test" step.This pull request includes various updates and additions to the project documentation, test files, import statements, command functionalities, and workflow configurations.
Issue
Part of #8
Type of change
Select one or more:
Testing
make test_all_unit
Sanity Checklist